LLibrary

LLibrary

67M Downloads

SliderElement throws NullPointerException when setting value when uninitialized

JamiesWhiteShirt opened this issue ยท 3 comments

commented

SliderElement delegates its state to an InputElement which is created during init. Because of this, the value cannot be set before init is called and throws a NullPointerException. This exception is unavoidable when using numerical values for ConfigGUI because this situation occurs.

java.lang.NullPointerException: Rendering screen
at net.ilexiconn.llibrary.client.gui.element.SliderElement.withValue(SliderElement.java:112)
at net.ilexiconn.llibrary.client.gui.config.ConfigGUI.createPropertyElement(ConfigGUI.java:162)
at net.ilexiconn.llibrary.client.gui.config.ConfigGUI.drawScreen(ConfigGUI.java:124)
at net.ilexiconn.llibrary.client.gui.ElementGUI.drawScreen(ElementGUI.java:49)
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:374)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1147)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139)
at net.minecraft.client.Minecraft.run(Minecraft.java:406)

commented

You can call init on the element manually, when you add it to the GUI.

commented

Not very easy to call init when ConfigGui doesn't.

commented

Ah, I see. Sorry, I didn't see that in your original message.