Posted February 5, 201411 yr My problem is that I have a hotkey set up to do something in the player's chest inventory when pressed. This worked in 1.6, but in 1.7 the new key handler event system does not allow the event to be fired when the user is looking at a GuiScreen. In Minecraft.java in the the runTick() method, then FMLCommonHandler.instance().fireKeyInput(); on line 1969 is not reached. I suggest changing it so that: 1) this event still fires even if the player is looking at a GuiScreen or 2) create a new KeyGuiInputEvent that fires when a key is pressed inside a GuiScreen
February 6, 201411 yr It depends on the gui actually, since each GuiScreen has a flag to allow key input or not. Plus, you can use ClientTickEvent. It is run really close to the KeyInputEvent.
February 18, 201411 yr Author Even if I do mc.currentScreen.allowUserInput = true on every game tick, Forge's hotkey event still does not fire when I look at a GuiChest and press the button. I know I have my hotkey setup correctly because I do a System.out.println() for each time it is pressed and that fires when I am not looking at a GuiScreen.
February 21, 201411 yr Author To resolve my issue, I ended up using the ClientTickEvent event. In it, I basically wrote my own key handler: private static boolean keyDown = false; public static void MyKeyTickHandler(ClientTickEvent event) { if(Keyboard.getEventKey() == Keyboard.KEY_X) { if(Keyboard.getEventKeyState()) { if(keyDown == false) OnKeyDown(); keyDown = true; } else { if(keyDown == true) OnKeyUp(); keyDown = false; } } }
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.