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

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.

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

  • Author

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

 

@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
	if(!FMLClientHandler.instance().isGUIOpen(GuiChat.class))
	{
		int key = Keyboard.getEventKey();
		boolean isDown = Keyboard.getEventKeyState();

		if(isDown && key == keyValues[AAA_KEY])
		{
			Minecraft.getMinecraft().thePlayer.openGui(MineGrades.instance,MineGrades.guiAAA,
    				Minecraft.getMinecraft().thePlayer.worldObj, 
    				(int)Minecraft.getMinecraft().thePlayer.posX, 
    				(int)Minecraft.getMinecraft().thePlayer.posY, 
    				(int)Minecraft.getMinecraft().thePlayer.posZ);
		}
	}
}

You have to set up your own Gui Handler..

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

You have to set up your own Gui Handler..

 

What makes you think he hasnt?

 

@SebasTheGreat Have you?

 

If so please show it and your gui class. Also have you checked to see if that code is actually being run?

 

 

I am the author of Draconic Evolution

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.