Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

  • 2 weeks later...
  • 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.

  • 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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.