PieKing1215 / InvMove

Minecraft Forge/Fabric/Quilt mod that adds the ability to walk around while in inventories
GNU Lesser General Public License v3.0
23 stars 7 forks source link

Game crashes when reading config file #10

Closed ChristopherHaws closed 2 years ago

ChristopherHaws commented 2 years ago

I am having an issue with this mod where some setting is being written to the file and from that point forward my game crashes on startup. When I delete the config files the game launches fine but eventually stops again and I have to delete the config files again.

Here is the logs:

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:211)
    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(java.base@17.0.2/Native Method)
    at java.lang.Class.forName(java.base@17.0.2/Class.java:375)
    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$5060/0x00000008015a4920.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 net.minecraft.class_310.<init>(class_310.java:452)
    at net.minecraft.client.main.Main.main(Main.java:197)
    at java.lang.invoke.LambdaForm$DMH/0x0000000800e2c400.invokeStaticInit(java.base@17.0.2/LambdaForm$DMH)
    at java.lang.invoke.LambdaForm$MH/0x0000000800ebc000.invokeExact_MT(java.base@17.0.2/LambdaForm$MH)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:460)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.2/Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.2/NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.2/DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(java.base@17.0.2/Method.java:568)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

The config files themself look like they are valid json, so I am not sure what it causing the crash. Here are the config files that are crashing my MC:

vanilla.json:

{
  "movement": {
    "inventory": true,
    "horseInventory": true,
    "creative": true,
    "crafting": true,
    "chest": true,
    "shulker": true,
    "dispenser": true,
    "hopper": true,
    "enchantment": true,
    "anvil": true,
    "beacon": true,
    "brewing": true,
    "furnace": true,
    "blastFurnace": true,
    "smoker": true,
    "loom": true,
    "cartography": true,
    "grindstone": true,
    "stonecutter": true,
    "villager": true,
    "book": true,
    "advancements": true
  },
  "backgroundHide": {
    "inventory": true,
    "horseInventory": true,
    "creative": true,
    "crafting": true,
    "chest": true,
    "shulker": true,
    "dispenser": true,
    "hopper": true,
    "enchantment": true,
    "anvil": true,
    "beacon": true,
    "brewing": true,
    "furnace": true,
    "blastFurnace": true,
    "smoker": true,
    "loom": true,
    "cartography": true,
    "grindstone": true,
    "stonecutter": true,
    "villager": true,
    "book": true,
    "advancements": true
  }
}

unrecognized.json

{
  "allowMovement": {
    "net.minecraft.class_434": false,
    "net.coderbot.iris.gui.screen.ShaderPackScreen": false,
    "net.minecraft.class_433": false,
    "com.kwpugh.simple_backpack.backpack.BackpackClientScreen": true,
    "xaero.map.gui.GuiMap": false,
    "xaero.map.gui.GuiWorldMapSettings": false,
    "xaero.common.gui.GuiMinimapMain": false,
    "xaero.common.gui.GuiWaypointSettings": false,
    "net.minecraft.class_4895": false,
    "me.flashyreese.mods.reeses_sodium_options.client.gui.SodiumVideoOptionsScreen": false,
    "fi.dy.masa.minihud.gui.GuiConfigs": false,
    "fi.dy.masa.minihud.gui.GuiShapeManager": false,
    "fi.dy.masa.minihud.gui.GuiShapeEditor": false,
    "eu.pb4.entityviewdistance.screen.EvdSettingsScreen": false,
    "fi.dy.masa.tweakeroo.gui.GuiConfigs": false,
    "fi.dy.masa.malilib.gui.GuiColorEditorHSV": false,
    "fi.dy.masa.litematica.gui.GuiMainMenu": false,
    "xaero.common.gui.GuiEntityRadarSettings": false
  },
  "hideBackground": {
    "com.kwpugh.simple_backpack.backpack.BackpackClientScreen": true,
    "net.minecraft.class_4895": true
  }
}

cloth-config.json

{
  "movement": {},
  "backgroundHide": {}
}
ChristopherHaws commented 2 years ago

From the logs I was able to determine that the bad config value is "fi.dy.masa.malilib.gui.GuiColorEditorHSV": false,. After removing this line the game launches.

PieKing1215 commented 2 years ago

Hmm I see why this can crash, I have a thing here where it does Class::fromName to get the class from the name in order to store it in a map, but I guess that class tries to load some shaders when it's loaded. https://github.com/PieKing1215/InvMove/blob/c41f822e4832caf94a23bbfbe7cb9fcf98b57ff5/common/src/main/java/me/pieking1215/invmove/InvMoveConfig.java#L441 I think if I change it to use the alternate forName(String name, boolean initialize, ClassLoader loader) with initialize=false it should stop that from happening. Otherwise I can change it to not use forName at all and just store strings in the map instead, should be a pretty quick fix either way

PieKing1215 commented 2 years ago

Fixed for next release hopefully within a couple days