1
0
forked from Clones/Controlify

🐛 Fix journeymap crash on Steam Deck (don't ask how idk either)

This commit is contained in:
isXander
2023-07-02 19:47:48 +01:00
parent 3c7b7f38e1
commit 31ff1824a5

View File

@ -15,10 +15,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class KeyboardHandlerMixin {
@Shadow @Final private Minecraft minecraft;
// m_unngxkoe is lambda for GLFW keypress hook - do it outside of the `keyPress` method due to fake inputs
// method_22678 is lambda for GLFW keypress hook - do it outside of the `keyPress` method due to fake inputs
@Inject(method = "method_22678", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyboardHandler;keyPress(JIIII)V"))
private void onKeyboardInput(long window, int i, int j, int k, int m, CallbackInfo ci) {
if (window == minecraft.getWindow().getWindow() && Controlify.instance().currentInputMode() != InputMode.MIXED)
Controlify.instance().setInputMode(InputMode.KEYBOARD_MOUSE);
}
// method_22677 is lambda for GLFW char input hook - do it outside of the `charTyped` method due to fake inputs
@Inject(method = "method_22677", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyboardHandler;charTyped(JII)V"))
private void onCharInput(long window, int codePoint, int modifiers, CallbackInfo ci) {
if (window == minecraft.getWindow().getWindow() && Controlify.instance().currentInputMode() != InputMode.MIXED)
Controlify.instance().setInputMode(InputMode.KEYBOARD_MOUSE);
}
}