Adventurecraft-Awakening / AC-Legacy-Mod

The Legend of AC, a story of Legacy.
MIT License
6 stars 5 forks source link

[Bug] crash when going into fullscreen #36

Closed kylianpl closed 1 year ago

kylianpl commented 1 year ago

OS: Archlinux Java: extra/jdk-openjdk 20.0.2.u9-3 using KDE Wayland

java.lang.ClassCastException: class com.github.zarzelcow.legacylwjgl3.implementation.glfw.GLFWMouseImplementation$$Lambda$258/0x00007f72a02feae8 cannot be cast to class org.lwjgl.glfw.GLFWScrollCallbackI (com.github.zarzelcow.legacylwjgl3.implementation.glfw.GLFWMouseImplementation$$Lambda$258/0x00007f72a02feae8 and org.lwjgl.glfw.GLFWScrollCallbackI are in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @62ee68d8)
    at org.lwjgl.glfw.GLFWScrollCallback.create(GLFWScrollCallback.java:38)
    at org.lwjgl.glfw.GLFWScrollCallback.createSafe(GLFWScrollCallback.java:47)
    at org.lwjgl.glfw.GLFW.glfwSetScrollCallback(GLFW.java:4214)
    at com.github.zarzelcow.legacylwjgl3.implementation.glfw.GLFWMouseImplementation.createMouse(GLFWMouseImplementation.java:85)
    at com.github.zarzelcow.legacylwjgl3.implementation.input.CombinedInputImplementation.createMouse(CombinedInputImplementation.java:51)
    at org.lwjgl.input.Mouse.create(Mouse.java:269)
    at org.lwjgl.input.Mouse.create(Mouse.java:295)
    at org.lwjgl.opengl.Display.initControls(Display.java:272)
    at org.lwjgl.opengl.Display.createWindow(Display.java:244)
    at org.lwjgl.opengl.Display.update(Display.java:120)
    at org.lwjgl.opengl.Display.update(Display.java:114)
    at net.minecraft.client.Minecraft.toggleFullscreen(Minecraft.java:1185)
    at net.minecraft.client.gui.screen.Screen.onKeyboardEvent(Screen.java:131)
    at net.minecraft.client.gui.screen.Screen.method_130(Screen.java:112)
    at net.minecraft.client.Minecraft.tick(Minecraft.java:2697)
    at net.minecraft.client.Minecraft.run(Minecraft.java:754)
    at net.minecraft.client.Minecraft.main(Minecraft.java:2385)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:462)
    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 net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
java.lang.IllegalStateException: Keyboard must be created before you can read events
    at org.lwjgl.input.Keyboard.next(Keyboard.java:276)
    at net.minecraft.client.gui.screen.Screen.method_130(Screen.java:111)
    at net.minecraft.client.Minecraft.tick(Minecraft.java:2697)
    at net.minecraft.client.Minecraft.run(Minecraft.java:754)
    at net.minecraft.client.Minecraft.main(Minecraft.java:2385)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:462)
    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 net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

this error may comes from legacy lwjgl 3 on linux

TechPizzaDev commented 1 year ago

So this is the code that caused ClassCastException:

https://github.com/LWJGL/lwjgl3/blob/b1421be49b969a96aa346f61ac3a926ce902a087/modules/lwjgl/glfw/src/generated/java/org/lwjgl/glfw/GLFWScrollCallback.java#L38-L41

Looks like an impossible bug to me and I have no clue how to "fix" this, so if it happens again, make a new issue.