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

I made a gui and it works, but I can only close it using the escape key. How can I set this to the 'E' key?

 

Look at the GuiContainer class.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

I made a gui and it works, but I can only close it using the escape key. How can I set this to the 'E' key?

 

Look at the GuiContainer class.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

So does this mean that pretty much every block that is intractable is a container? Containers don't have to literally contain something do they? They can store data like a sign right?

  • Author

So does this mean that pretty much every block that is intractable is a container? Containers don't have to literally contain something do they? They can store data like a sign right?

Your Gui can extend GuiScreen and your block can implement ITileEntityProvider if you don't want a container. This also means that you don't need to pass a Container to the server in your GuiHandler. I know this works because my mod currently already does this. As for closing the currently opened Gui, just use:

mc.displayGuiScreen((GuiScreen)null);

if calling this from a gui window, or:

Minecraft.getMinecraft().displayGuiScreen((GuiScreen)null);

from anywhere else in the client code.

 

If you want to close it with the E key, then you'll have you use a KeyHandler. There are plenty of tutorials about them. Be aware that if you register a KeyBinding using the same key as one that Minecraft already uses, it'll override it and make it not function normally anymore. This means that if you bind the above code to the E key, opening your inventory won't work anymore

...unless you use this little trick that I figured out myself:

Minecraft.getMinecraft().gameSettings.keyBindJump = KeysHandler.jump;

In this case, I have my own KeyBinding (KeysHandler.jump) using the space key. By binding Minecraft's normal keybind to mine, both it and my mod can use the key however they needs to.

width=336 height=83http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img]

I make games, minecraft mods/plugins, and some graphic art.

 

Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.

Your Gui can extend GuiScreen and your block can implement ITileEntityProvider if you don't want a container. This also means that you don't need to pass a Container to the server in your GuiHandler. I know this works because my mod currently already does this. As for closing the currently opened Gui, just use:

mc.displayGuiScreen((GuiScreen)null);

if calling this from a gui window, or:

Minecraft.getMinecraft().displayGuiScreen((GuiScreen)null);

from anywhere else in the client code.

 

If you want to close it with the E key, then you'll have you use a KeyHandler. There are plenty of tutorials about them. Be aware that if you register a KeyBinding using the same key as one that Minecraft already uses, it'll override it and make it not function normally anymore. This means that if you bind the above code to the E key, opening your inventory won't work anymore

...unless you use this little trick that I figured out myself:

Minecraft.getMinecraft().gameSettings.keyBindJump = KeysHandler.jump;

In this case, I have my own KeyBinding (KeysHandler.jump) using the space key. By binding Minecraft's normal keybind to mine, both it and my mod can use the key however they needs to.

width=336 height=83http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img]

I make games, minecraft mods/plugins, and some graphic art.

 

Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.

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.