Jump to content

Keybind-ed GUI toggling


Creepmander

Recommended Posts

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.

Link to comment
Share on other sites

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

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.

×
×
  • Create New...

Important Information

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