Update key and mouse handling in preparation for 1.21.9
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user