Creepmander Posted October 1, 2013 Share Posted October 1, 2013 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. Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 1, 2013 Author Share Posted October 1, 2013 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? Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 1, 2013 Author Share Posted October 1, 2013 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.. Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 1, 2013 Author Share Posted October 1, 2013 Okay, I have just solved it. Thanks diesieben07! Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 1, 2013 Author Share Posted October 1, 2013 Okay, I asked it.^^ * Quote Link to comment Share on other sites More sharing options...
gjgfuj Posted October 1, 2013 Share Posted October 1, 2013 toggling a boolean, means, you have a boolean b, b = !b; that basically means if it is true, it becomes false, and vice-versa. Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 2, 2013 Author Share Posted October 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
GotoLink Posted October 2, 2013 Share Posted October 2, 2013 if(!mc.currentScreen instanceof MyNewScreen) //open MyNewScreen else //close Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 2, 2013 Author Share Posted October 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
GotoLink Posted October 2, 2013 Share Posted October 2, 2013 My bad, you use mc.ingameGUI ,right ? Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 2, 2013 Author Share Posted October 2, 2013 Yes I use it. Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 3, 2013 Author Share Posted October 3, 2013 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 Quote Link to comment Share on other sites More sharing options...
Creepmander Posted October 4, 2013 Author Share Posted October 4, 2013 Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.