Kosh Posted November 10, 2022 Share Posted November 10, 2022 (edited) Hello. I have a problem with my gui screen. It crash game from time to time(but mostly it works correctly) without any obvoiuse reasons, when it tries to call "super.renderBackground". java.lang.NullPointerException: Cannot read field "level" because "this.minecraft" is null at net.minecraft.client.gui.screens.Screen.renderBackground(Screen.java:442) ~[forge-1.19.2-43.1.47_mapped_official_1.19.2-recomp.jar%23183!/:?] May be some one know why it happens? My screen: https://github.com/NightKosh/Sophisticated-wolves/blob/feature/1.19.2_update/src/main/java/sophisticated_wolves/gui/WolfFoodConfigScreen.java "debug" and "latest" logs https://gist.github.com/NightKosh/e73c29bb2ea336b1d6336f64d92ec384 Edited November 10, 2022 by Kosh Quote Link to comment Share on other sites More sharing options...
MistaOmega Posted November 10, 2022 Share Posted November 10, 2022 (edited) Line 522: java.lang.IllegalStateException: Rendersystem called from wrong thread Screens are client side only, so make sure you're opening the screen from the client Edited November 10, 2022 by MistaOmega 1 Quote Link to comment Share on other sites More sharing options...
Kosh Posted November 10, 2022 Author Share Posted November 10, 2022 (edited) 10 minutes ago, MistaOmega said: Line 522: java.lang.IllegalStateException: Rendersystem called from wrong thread Screens are client side only, so make sure you're opening the screen from the client So Minecraft.getInstance().setScreen(....); opens screen for both client and server side? It looks like it solve my problem. Thank you! Edited November 10, 2022 by Kosh 1 Quote Link to comment Share on other sites More sharing options...
MistaOmega Posted November 10, 2022 Share Posted November 10, 2022 Yeah, I'd check to see what tick that you're referencing during this block: else if (FoodUtils.isBone(stack)) { Minecraft.getInstance().setScreen(new WolfFoodConfigScreen(this)); stack.shrink(1); return InteractionResult.SUCCESS; } add a level.IsClientSide() check before setting that screen so that when the server side tick passes through that function, it is ignored 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.