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

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 ?

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

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

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.