Hello,
I have implemented keybindings for my mod like this:
public void clientSetup(final FMLClientSetupEvent event) {
int keyCode = 297;
String description = "description";
keybinding = new KeyBinding(description, KeyConflictContext.UNIVERSAL, KeyModifier.NONE, InputMappings.Type.KEYSYM, keyCode, "category");
ClientRegistry.registerKeyBinding(keybinding);
}
@SubscribeEvent
public void keyPressed(InputEvent.KeyInputEvent event) {
if (keybinding.isPressed()) {
// do something
}
}
I first register the keybinding in the FMLClientSetupEvent and then I use the isPressed method inside of a KeyInputEvent to find out whether the keybinding has been pressed.
This works great in most cases.
The only problem is, that it does not work in ChestScreens.
Does anybody know why that could be the case?
Henne