Jump to content

KeyBinding don't trigger when in gui?


Cobiyyy

Recommended Posts

59 minutes ago, diesieben07 said:

That is normal, key bindings are disabled in a Screen.

Check out the various keyboard related events in GuiScreenEvent for detecting keyboard input while a screen is open.

Note that this might not be a good idea, due to for example text input fields.

I see like for JEI they could type something and it would trigger what ever i am trying to do.

Link to comment
Share on other sites

  • 9 months later...

Resurrecting this thread to ask:

Is there a way to enable keybindings while in a GUI?

I've been able to use GuiScreenEvent.KeyboardKeyEvent but for detecting held buttons it has a delay after the initial press, just like when holding down a button to repeat the same character while typing. The same is true for getGui().keyPressed(). However, keybindings do not have this issue and are guaranteed to execute code smoothly when a key is held.

I've noticed that some GUI screens do in fact allow keybindings when open, like the player inventory screen. Is there a way to also allow use of keybindings on custom GUIs?

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.

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

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

Announcements



×
×
  • Create New...

Important Information

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