Posted October 1, 201311 yr 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.
October 1, 201311 yr 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?
October 1, 201311 yr 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..
October 1, 201311 yr toggling a boolean, means, you have a boolean b, b = !b; that basically means if it is true, it becomes false, and vice-versa.
October 2, 201311 yr Author I searched for it on Google. 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.
October 2, 201311 yr 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.
October 3, 201311 yr 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.