Made Booklet closable with Inventory key

This commit is contained in:
Ellpeck 2015-12-04 22:40:36 +01:00
parent 32a42643c9
commit d574ce7fd4

View file

@ -168,10 +168,16 @@ public class GuiBooklet extends GuiScreen{
@Override @Override
public void keyTyped(char theChar, int key){ public void keyTyped(char theChar, int key){
if(key == Keyboard.KEY_ESCAPE && this.parentScreen != null){ if(key == Keyboard.KEY_ESCAPE || key == Minecraft.getMinecraft().gameSettings.keyBindInventory.getKeyCode()){
this.mc.displayGuiScreen(this.parentScreen); 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); this.searchField.textboxKeyTyped(theChar, key);
BookletUtils.updateSearchBar(this); BookletUtils.updateSearchBar(this);
} }
@ -188,7 +194,6 @@ public class GuiBooklet extends GuiScreen{
} }
else{ else{
this.hisNameIsAt = 0; this.hisNameIsAt = 0;
super.keyTyped(theChar, key);
} }
} }
} }