Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public class KeyEventHandler implements IEventHandler {
  2.  
  3. public static boolean isChalkGuiOpen = false;
  4.  
  5. @SubscribeEvent
  6. public void keyEvent(InputEvent.KeyInputEvent keyInputEvent)
  7. {
  8. System.out.println("key event got");
  9. if (ModKeybind.keybindChalk.isPressed()&&!isChalkGuiOpen)
  10. {
  11. Minecraft.getMinecraft().displayGuiScreen(new GuiChalk());
  12. isChalkGuiOpen = true;
  13. }
  14. }
  15.  
  16.  
  17. @SubscribeEvent
  18. public void keyEvent(GuiScreenEvent.KeyboardInputEvent keyInputEvent)
  19. {
  20. boolean isPressed = ModKeybind.keybindChalk.isPressed();
  21. boolean isDown = ModKeybind.keybindChalk.isKeyDown();
  22.  
  23. if(isChalkGuiOpen&&ModKeybind.keybindChalk.isPressed())
  24. {
  25. System.out.println("trying to close gui");
  26. Minecraft.getMinecraft().displayGuiScreen(null);
  27. isChalkGuiOpen = false;
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement