Cooking for Blockheads

Cooking for Blockheads

145M Downloads

[Bug] missing IMCHandler when another mod present

Unixkitty opened this issue ยท 2 comments

commented

Versions

  • Minecraft Version (exact version number): 1.16.5
  • Forge Version (exact version number): 36.1.4+
  • Mod Version (exact version number): 9.3.3
  • Do you use Sponge, OptiFine or Vivecraft (and which?): N/A for this issue

Describe the bug
Dedicated server (and ONLY the dedicated server) refuses to start when both this mod and "New TARDIS Mod" are present together.

The client and integrated server work fine.

https://www.curseforge.com/minecraft/mc-mods/new-tardis-mod
https://gitlab.com/Spectre0987/TardisMod-1-14

To Reproduce
Steps to reproduce the behavior:

  1. Set up a clean dedicated server with forge
  2. Put CookingForBlockheads jar and TARDIS jar (based on commit 2a2b27be65367238bcb8bcc6c0ca23ac0a629cd8 at the time of writing) into mods folder
  3. Launch server

Expected behavior
Server starts, can play the game.

Additional context (e.g. Crash Log if it crashed)
Tried with different java versions from 8 to 15, as well as forge 36.2.2.
Crash log: https://gist.githubusercontent.com/Unixkitty/016e145e8f10b8bfbaca14d00e0abd17/raw/d237058f117760739bdd9d9ec0c6f04e236ae927/debug.log

Link to corresponding issue on the other mod's tracker https://gitlab.com/Spectre0987/TardisMod-1-14/-/issues/211

commented

Hello, I am a developer from the Tardis Mod, the mod that has a conflict with this mod.

I can also consistently reproduce this issue.

I have confirmed with Forge support that the cause of the issue is related to your mod loading client side classes in an area which is accessed by dedicated servers. Client side classes do not exist on servers due to how Minecraft strips the client side related code, which is why this issue can occur.

https://github.com/ModdingForBlockheads/CookingForBlockheads/blob/1.16.x/src/main/java/net/blay09/mods/cookingforblockheads/CookingForBlockheads.java#L142

Could you please move client side code to a seperate class to reduce classloading issues like this case?

Many thanks.

commented

Hello,

This issue seems to have not been fixed as of version 9.3.4 as reported by a user in following issue report.

Their crash report is identical to the original one in this issue report.

The source of the issue seems to start from the main mod class CookingForBlockHeads#addReloadListenersLate which still loads client side classes in an area that is also loaded by the server.

This method is calling CookingRegistry#initFoodRegistry

Next, CookingRegistry#initFoodRegistry is initialising an instance of FoodRegistryInitEvent which is then posted to the Forge event bus.

However, FoodRegistryInitEvent is then subscribed to in multiple places, first in JsonCompatLoader, then once more in IMCHandler#onFoodRegistryInit, which could explain why IMCHandler is being mentioned in both crash reports.

Could this issue please be reviewed once more? Many thanks.