I tried to create keyinputlistener for my specific uses but i can't find reason why my function keyInputEvent
nor Overrided function invoke
from org.lwjgl.glfw.GLFWKeyCallbackI
class don't execute every time there is a keyboard input. And yes i initialized my class. Here is my class:
package net.shadowgrum.shadowclient;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFWKeyCallbackI;
import java.util.Objects;
public class KeyInputListener implements GLFWKeyCallbackI {
public KeyInputListener() {}
@Override
public void invoke(long window, int key, int scancode, int action, int mods) {
System.out.println("you pressed"+key);
keyInputEvent(window, KeyTranslator.toKey(key, scancode), action, mods);
}
public void keyInputEvent(long window, InputUtil.Key key, int action, int mods){
if (Objects.equals(key.getTranslationKey(), "key.keyboard.k") && action == 1) {
SomeThing.toggle();
}
}
}
I tried to Override other methods that i found in minecraft source code that seems to execute every keyinput but i wasn't successful. Can you please help me? :)