Advanced-Rocketry / AdvancedRocketry

Space mod for minecraft
http://arwiki.dmodoomsirius.me/
MIT License
217 stars 273 forks source link

[BUG] [1.16.5] Server does not shut down properly, leading to world corruption #2221

Open SamboyCoding opened 2 years ago

SamboyCoding commented 2 years ago

Version of Advanced Rocketry

1.16.5-2.0.0-16

Have you verified this is an issue in the latest unstable build

Version of LibVulpes

1.16.5-1.0.2-27

Version of Minecraft

1.16.5

Does this occur without other mods installed

Crash report or log or visualVM (if applicable)

https://gist.github.com/SamboyCoding/e6b4e10c5fc9bd83006732665a31b097

Description of the problem

When saving and quitting in singleplayer, or shutting down a dedicated server, the exception above occurs, and the server doesn't actually stop. This inevitably leads to world corruption as well as not being able to load back into the world in singleplayer.

SamboyCoding commented 2 years ago

From discussions in the forge discord, FMLJavaModLoadingContext.get() is null outside of the initial game loading process. On top of that, the line in question, https://github.com/Advanced-Rocketry/AdvancedRocketry/blob/1.16.5/src/main/java/zmaster587/advancedRocketry/atmosphere/AtmosphereHandler.java#L81 is not even required as the handler is never registered to that bus, only to MinecraftForge.EVENT_BUS.

Finally, the forge developers suggest against creating multiple handler instances for the same event, and suggest instead

Just have a global event handler that delegates if necessary

netcore10 commented 2 years ago

Happens to me too xD