Posted January 12, 20178 yr Hi ! I'm still working on my Item Editor GUI mod. The mod is working well, but I need something else. At the moment, the GUI opens when the player has an item in his mainhand and when he press the "I" hotkey. What I also would like to do, is to detect when a player press the hotkey in his inventory while hovering an item. The problem is, the event I use (KeyInputEvent) only fires when the player is out of a GUI (when he is "in game"). Does someone know how can I do that ?
January 12, 20178 yr Author Oh you're right, thanks. So if I put if(e.getGui() instanceof GuiInventory) after that, my code will always run if it's in the player inventory, right ?
January 12, 20178 yr Author Thanks ! So now when I press a key the event fires, but I can't detect when my hotkey is pressed. This is what I've done : @SideOnly(Side.CLIENT) @SubscribeEvent public void onGuiKeyPressed(KeyboardInputEvent e) { System.out.println("Key pressed in GUI"); KeyBinding[] keyBindings = ClientProxy.keyBindings; // Registered in initialisation if (keyBindings[0].isPressed()){ // The keybinding I use System.out.println("Binded key pressed in GUI"); } } I use my keyBindings[0].isPressed() condition in my KeyInputEvent and it works, but here it doesn't.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.