AmyMialeeMods / halfdoors

Half Size Hatches
https://amymialee.xyz/
Other
2 stars 8 forks source link

[crash] you are using `getKeyText` on a key that isn't bind #2

Closed FederAndInk closed 2 years ago

FederAndInk commented 2 years ago

You are using getKeyText on a key that isn't bind, this is crashing the game on load:

[12:43:31] [Render thread/WARN]: Failed to create window: 
net.minecraft.class_1041$class_4716: GLFW error 65540: Invalid scancode -1
    at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.3) ~[?:?]
    at net.minecraft.client.util.Window.throwGlError(Window:218) ~[?:?]
    at org.lwjgl.glfw.GLFWErrorCallbackI.callback(GLFWErrorCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:?]
    at org.lwjgl.system.JNI.invokeP(Native Method) ~[lwjgl-3.2.2.jar:?]
    at org.lwjgl.glfw.GLFW.nglfwGetKeyName(GLFW.java:3288) ~[lwjgl-glfw-3.2.2.jar:?]
    at org.lwjgl.glfw.GLFW.glfwGetKeyName(GLFW.java:3348) ~[lwjgl-glfw-3.2.2.jar:?]
    at net.minecraft.client.util.InputUtil$Type.method_27450(InputUtil:195) ~[?:?]
    at net.minecraft.client.util.InputUtil$Key.method_27444(InputUtil:390) ~[?:?]
    at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:183) ~[guava-31.0.1-jre.jar:?]
    at net.minecraft.util.Lazy.get(Lazy:19) ~[?:?]
    at net.minecraft.client.util.InputUtil$Key.getLocalizedText(InputUtil:407) ~[?:?]
    at net.minecraft.client.option.KeyBinding.getKeyText(KeyBinding:595) ~[?:?]
    at net.minecraft.client.option.KeyBinding.handler$ifo000$getTranslatedKeyMessage(KeyBinding:583) ~[?:?]
    at net.minecraft.client.option.KeyBinding.getBoundKeyLocalizedText(KeyBinding) ~[?:?]
    at amymialee.halfdoors.items.DoorFlipperItem.appendTooltip(DoorFlipperItem.java:179) ~[half-doors-1.18.2-fabric-1.3.6.jar:?]
    at net.minecraft.item.ItemStack.getTooltip(ItemStack:685) ~[?:?]
    at net.minecraft.client.MinecraftClient.method_1485(MinecraftClient:774) ~[?:?]
    at net.minecraft.client.search.TextSearchableContainer.index(TextSearchableContainer:36) ~[?:?]
    at net.minecraft.client.search.IdentifierSearchableContainer.add(IdentifierSearchableContainer:48) ~[?:?]
    at net.minecraft.client.MinecraftClient.method_1535(MinecraftClient:787) ~[?:?]
    at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
    at net.minecraft.client.MinecraftClient.initializeSearchableContainers(MinecraftClient:786) ~[?:?]
    at net.minecraft.client.MinecraftClient.<init>(MinecraftClient:576) ~[?:?]
    at net.minecraft.client.main.Main.main(Main:197) [client-intermediary.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:461) [fabric-loader-0.14.7.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) [fabric-loader-0.14.7.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.14.7.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
    at org.multimc.impl.OneSixLauncher.invokeMain(OneSixLauncher.java:104) [NewLaunch.jar:?]
    at org.multimc.impl.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:175) [NewLaunch.jar:?]
    at org.multimc.impl.OneSixLauncher.launch(OneSixLauncher.java:185) [NewLaunch.jar:?]
    at org.multimc.EntryPoint.listen(EntryPoint.java:127) [NewLaunch.jar:?]
    at org.multimc.EntryPoint.main(EntryPoint.java:57) [NewLaunch.jar:?]
AmyMialee commented 2 years ago

Which keys would that be? Just one example for testing would be enough.

FederAndInk commented 2 years ago

well, it's your key, and it's when you add tooltip: amymialee.halfdoors.items.DoorFlipperItem.appendTooltip(DoorFlipperItem.java:179)

sorry for not being precise, its when unbinding your key and restart the game

AmyMialee commented 2 years ago

I can't seem to cause the crash, can you try with this? https://cdn.discordapp.com/attachments/793182374410059887/993967124483682344/half-doors-1.18.2-fabric-1.3.7.jar

FederAndInk commented 2 years ago

To cause the crash, the key "Door Flip" must be unbound by hitting escape when changing it, then just restart the game.

Screenshot_20220705_230900

The crash happens when restarting the game. Your fix is working, by the way.

AmyMialee commented 2 years ago

yea it won't happen for me, but if the fix works that should be fine, i'll publish it at some point

FederAndInk commented 2 years ago

Maybe a locale thing or a different version of glfw. But anyway, thanks for the fix.