Jump to content

Suggestion: KeyInputEvent() should fire on GuiScreens


Recommended Posts

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


2) create a new KeyGuiInputEvent that fires when a key is pressed inside a GuiScreen

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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(keyDown == false)
		keyDown = true;
		if(keyDown == true)
		keyDown = false;


Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.