Update key and mouse handling in preparation for 1.21.9

This commit is contained in:
Jonas Herzig
2025-10-12 14:36:35 +02:00
parent f299644254
commit e6db9daf80
21 changed files with 153 additions and 134 deletions

View File

@@ -2,6 +2,7 @@ package com.replaymod.core.mixin;
import com.replaymod.core.events.KeyBindingEventCallback;
import com.replaymod.core.events.KeyEventCallback;
import de.johni0702.minecraft.gui.function.KeyInput;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Keyboard;
import org.spongepowered.asm.mixin.Mixin;
@@ -15,7 +16,7 @@ public class MixinKeyboardListener {
private static void beforeKeyBindingTick(CallbackInfo ci) {
int keyCode = Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey();
int action = Keyboard.getEventKeyState() ? KeyEventCallback.ACTION_PRESS : KeyEventCallback.ACTION_RELEASE;
if (KeyEventCallback.EVENT.invoker().onKeyEvent(keyCode, 0, action, 0)) {
if (KeyEventCallback.EVENT.invoker().onKeyEvent(new KeyInput(keyCode), action)) {
ci.cancel();
}
}