NeoForge icon indicating copy to clipboard operation
NeoForge copied to clipboard

Extending the RecipeBookType enum causes connection issues when joining vanilla servers

Open vectorwing opened this issue 2 years ago • 0 comments

Minecraft Version: 1.20.1

Forge Version: 47.1.75

Logs: https://gist.github.com/vectorwing/8e68ce679db345f222f73fb5b4b9e812

The log above makes use of the mod Spit It Out to reveal Netty exceptions.

Steps to Reproduce:

  1. Create a client instance with a mod which implements its own vanilla recipe book (example: Farmer's Delight);
  2. Start a vanilla Minecraft server, local or remote;
  3. Attempt to connect to this server. 3.1. Attempt to connect while adding other mods which do not have recipe books.

Description of issue: Recently, I've received an influx of issues from users attempting to use a modded client to connect to "server lobbies", a system where they may be redirected to either vanilla servers or modded servers, all from one client. This seems to utilize plugins such as BungeeCord to accomplish it.

Although I understand mods should not be expected to work in this scenario, all Forge and NeoForge mods seemed to play along... except Farmer's Delight (FD).

After troubleshooting this issue extensively with other developers, we figured out the cause: in order to add a recipe book, FD has to extend the RecipeBookType enum. Since it is non-extendable in vanilla, and Forge makes it extendable, a vanilla server struggles to process the additional data, which causes a packet exception. This prevents the client from connecting.

Removing the line below fixes the issue, but prevents FD from implementing its recipe book to begin with: https://github.com/vectorwing/FarmersDelight/blob/5c1b4cde76eb64fbd86f2c16e17e9993cd40093d/src/main/java/vectorwing/farmersdelight/FarmersDelight.java#L28

Considering that NeoForge has a feature set for allowing mods to use the vanilla recipe book, I figured it would be worthwhile to look into a solution for this issue. The interfaces are unusable in this scenario anyway.

vectorwing avatar Sep 26 '23 03:09 vectorwing