Jump to content

[1.7.10] [SOLVED] How do I open a GUI with the press of a key?


Recommended Posts

Hey so, as the title has stated, I'm trying to open a GUI by pressing a key. I have the key handler set up but I don't know how to link it to the GUI. I've tried different combinations of things including using packets and just telling the onKeyImput method directly to open the GUI but nothing has worked. If anyone can point me in the right direction I would be very appreciated.

Link to comment
Share on other sites

What kind of gui is it? If it involves a container you will need to send a packet to the server and open the gui from there. The same way you would open a gui for a block. If its a client side gui you can just open it from your key input handler.


If you cant get it to work please show what you tried.

I am the author of Draconic Evolution

Link to comment
Share on other sites

It is a client side GUI and the code I could come up with seems logical (to me) but doesn't work.


public void onKeyInput(InputEvent.KeyInputEvent event)
		int key = Keyboard.getEventKey();
		boolean isDown = Keyboard.getEventKeyState();

		if(isDown && key == keyValues[AAA_KEY])

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.