fabric: `ScreenEvents.afterRender`'s screen null check fails when opening the disconnect screen
Running the following in my screen’s render method results in the null check failing, and crashing the game.
client.getInstance().world.disconnect();
client.getInstance().disconnect(new SaveLevelScreen(new TranslatableText("menu.savingLevel")));
My screen’s code and the code that calls it Crash Log
Though, if I strip everything and just have the code in the code block in the render, and nothing else, it still crashes. If I run the code instead of opening the screen, it doesn’t crash.
The code in the quit method is practically identical to the code in the vanilla’s exit to main menu button
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (16 by maintainers)
Like use an atomic boolean that is set to true in render method when the screen needs to quit. In tick method you detect if the boolean is true and quit accordingly if it is.