illusivesoulworks / comforts

Minecraft Mod: Adds sleeping bags and hammocks for, respectively, portability and turning day to night, without setting new spawns. Comes in 16 different colors!
https://www.curseforge.com/minecraft/mc-mods/comforts
Other
46 stars 32 forks source link

[Bug]: Comforts annotates `CreativeModTab.makeIcon` as `OnlyIn(Dist.CLIENT)` despite the vanilla method being present on both sides. #114

Closed alcatrazEscapee closed 1 year ago

alcatrazEscapee commented 1 year ago

Minecraft Version

1.18.2

What happened?

As seen here:

https://github.com/illusivesoulworks/comforts/blob/4760e56ce25863d9f4c7da92f19dad212e9fca70/forge/src/main/java/top/theillusivec4/comforts/ComfortsMod.java#L81

Comforts is annotating a vanilla method as @OnlyIn(Dist.CLIENT), which causes it to be not present in dedicated server, despite the vanilla method not being annotated as such. In particular, vanilla stopped side-specific method stripping like this since 1.17.

This has the effect of stripping out the method implementation in a dedicated server, meaning any other mod which calls makeIcon() has the potential to cause a crash.

How do you trigger this bug?

This can be triggered via any code that calls CreativeModeTab.makeIcon() on a dedicated server, for any creative tab. As it will error with an AbstractMethodError due to the required implementation not being present on server.

Loader

Forge

Loader Version

40.2.1

API Version

No response

Mod Version

forge-1.18.2-5.0.0.3

Relevant Log Outputs

The following is an example crash I was having which is due to this issue. In particular, TerraFirmaCraft has some code which calls CreativeModeTab.makeIcon on a dedicated server, which will crash due to an AbstractMethodError when Comforts is present.

crash-2023-02-15_19.09.47-fml.txt