From d574ce7fd496d7c748a93827b76d526ec8b222e3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 4 Dec 2015 22:40:36 +0100 Subject: [PATCH] Made Booklet closable with Inventory key --- .../actuallyadditions/booklet/GuiBooklet.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index 667eaaf52..53139dd6a 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -168,10 +168,16 @@ public class GuiBooklet extends GuiScreen{ @Override public void keyTyped(char theChar, int key){ - if(key == Keyboard.KEY_ESCAPE && this.parentScreen != null){ - this.mc.displayGuiScreen(this.parentScreen); + if(key == Keyboard.KEY_ESCAPE || key == Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode()){ + if(this.parentScreen != null){ + this.mc.displayGuiScreen(this.parentScreen); + } + else{ + this.mc.displayGuiScreen(null); + this.mc.setIngameFocus(); + } } - else if(this.searchField.isFocused() && key != Keyboard.KEY_ESCAPE){ + else if(this.searchField.isFocused()){ this.searchField.textboxKeyTyped(theChar, key); BookletUtils.updateSearchBar(this); } @@ -188,7 +194,6 @@ public class GuiBooklet extends GuiScreen{ } else{ this.hisNameIsAt = 0; - super.keyTyped(theChar, key); } } }