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 made a Keybinded gui.

(If i press the button the Gui appears.)

Well, I want to make a toggle into this keybind.

(I press the key, the Gui comes up and if I press the key again the Gui disappears.)

 

The KeyHandler:

public class GuiKeyHandler extends KeyHandler
{
private EnumSet tickTypes = EnumSet.of(TickType.CLIENT);

public static boolean keyPressed = false;

public GuiKeyHandler(KeyBinding[] keyBindings, boolean[] repeatings)
{
	super(keyBindings, repeatings);
}
@Override
public String getLabel()
{
	return "GuiSwitch";
}
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat)
{
	keyPressed = true;
	final Minecraft mc = Minecraft.getMinecraft();
	mc.ingameGUI = new GuiIngameNew(mc);
}
@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd)
{
	keyPressed = false;
}
@Override
public EnumSet<TickType> ticks()
{
	return tickTypes;
}
}

 

I show the other files if it needs.

  • Author

I know what I do when I replace the GuiIngame, and I know I need it. :)

But, I dont uderstand

Then just toggle a boolean field in your key handler and in your render code check for that boolean.

Can you show me an example or make? ;)

  • Author
If you don't know what toggling a boolean means, you surely need to go and learn java before you continue modding.

Sorry, but Im 16 Years old and I now learning Java :)

 

What are you doing? Please explain. You can change the whole GUI without replacing GuiIngame.

Have you ever played RaiderZ?

I need to make a "GuiIngame" system like that.

So, this is a big project with my friends..

toggling a boolean, means, you have a boolean b,

b = !b;

that basically means if it is true, it becomes false, and vice-versa.

  • Author

I searched for it on Google. xD

But it isnt works :/ When I pressed the key, the gui appeared and disappeared and repeated this thing so fast, when i press the key again nothing happend.

  • Author

GotoLink

if(!mc.currentScreen instanceof MyNewScreen)

//open MyNewScreen

else

//close

This isn't work, I think 'couse the GuiIngame isn't a GuiScreen it is a simple Gui, but I dont know.

  • Author

I haven't see anything like that.

You can use the RenderGameOverlay event to stop all vanilla HUD from rendering and then render your own stuff.

I dont know how I can do it :|

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.