You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using the InvMove mod, which does some cursed black magic, requiring classes to be loaded during the startup phase.
This is so it can identify non-mc screens & allow the user to enable/disable movement with those screens.
However, this causes an issue with malilib, when it attempts to load GuiColorEditorHSV.
This is because it statically loads a ShaderProgram.
If this ShaderProgram is loaded during the startup phase, the following exception will be thrown:
FATAL ERROR in native method: Thread[Render thread,5,main]: No context is current or a function that is not available in the current context was called. The JVM will abort execution.
at org.lwjgl.opengl.GL20C.glCreateProgram(Native Method)
at org.lwjgl.opengl.GL20.glCreateProgram(GL20.java:188)
at fi.dy.masa.malilib.render.shader.ShaderProgram.init(ShaderProgram.java:38)
at fi.dy.masa.malilib.render.shader.ShaderProgram.<init>(ShaderProgram.java:27)
at fi.dy.masa.malilib.gui.GuiColorEditorHSV.<clinit>(GuiColorEditorHSV.java:24)
at java.lang.Class.forName0([email protected]/Native Method)
at java.lang.Class.forName([email protected]/Class.java:383)
at java.lang.Class.forName([email protected]/Class.java:376)
at me.pieking1215.invmove.InvMoveConfig.readUnrecognizedConfig(InvMoveConfig.java:441)
at me.pieking1215.invmove.InvMoveConfig.load(InvMoveConfig.java:336)
at me.pieking1215.invmove.InvMove.init(InvMove.java:43)
at me.pieking1215.invmove.fabric.InvMoveFabric.onInitializeClient(InvMoveFabric.java:35)
at net.fabricmc.loader.impl.game.minecraft.Hooks$$Lambda$3914/0x0000000800b01850.accept(Unknown Source)
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke(EntrypointUtils.java:35)
at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:53)
at fudge.notenoughcrashes.fabric.mixinhandlers.ModLoaders.fabricEntrypoints(ModLoaders.java:9)
at net.minecraft.class_310.redirect$fdj000$catchFabricInit(class_310.java:21453)
at net.minecraft.class_310.<init>(class_310.java:452)
at net.minecraft.client.main.Main.main(Main.java:197)
A fix for this would be to lazy-load the ShaderProgram. It would be initialized to null, and only loaded when needed. Alternatively, move it to a separate class.
The text was updated successfully, but these errors were encountered:
solonovamax
changed the title
Lazy load SHADER_HUE in GuiColorEditorHSV to prevent crashes from the class being loaded to early
Lazy load SHADER_HUE in GuiColorEditorHSV to prevent crashes from the class being loaded too early
May 8, 2022
I am currently using the InvMove mod, which does some cursed black magic, requiring classes to be loaded during the startup phase.
This is so it can identify non-mc screens & allow the user to enable/disable movement with those screens.
The code for loading the classes can be found here
However, this causes an issue with malilib, when it attempts to load
GuiColorEditorHSV
.This is because it statically loads a
ShaderProgram
.If this
ShaderProgram
is loaded during the startup phase, the following exception will be thrown:A fix for this would be to lazy-load the
ShaderProgram
. It would be initialized tonull
, and only loaded when needed. Alternatively, move it to a separate class.The text was updated successfully, but these errors were encountered: