From 6b72c66f0ac0e1f34660cec244b8a8e6687f0918 Mon Sep 17 00:00:00 2001 From: Azanor Date: Sat, 19 Apr 2014 18:24:52 +0200 Subject: [PATCH] undoing the "baubles hotkey closes all inventories" change undoing the "baubles hotkey closes all inventories" change. It was messing with anything that allows text input --- build.gradle | 2 +- .../baubles/client/gui/GuiPlayerExpanded.java | 11 +++++++++ src/main/java/baubles/common/Baubles.java | 4 ++-- .../java/baubles/common/event/KeyHandler.java | 24 ++++--------------- src/main/resources/changelog.txt | 3 +++ 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 4c07de8..a94d709 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.2-1.0.0.8" +version = "1.7.2-1.0.0.9" group= "com.azanor.baubles" archivesBaseName = "Baubles" diff --git a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java index bf18047..295011b 100644 --- a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java +++ b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java @@ -137,5 +137,16 @@ public class GuiPlayerExpanded extends InventoryEffectRenderer { this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter())); } } + + @Override + protected void keyTyped(char par1, int par2) { + if (par2 == Baubles.proxy.keyHandler.key.getKeyCode()) + { + this.mc.thePlayer.closeScreen(); + } else + super.keyTyped(par1, par2); + } + + } diff --git a/src/main/java/baubles/common/Baubles.java b/src/main/java/baubles/common/Baubles.java index 9c91571..e37ae99 100644 --- a/src/main/java/baubles/common/Baubles.java +++ b/src/main/java/baubles/common/Baubles.java @@ -20,13 +20,13 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = Baubles.MODID, name = Baubles.MODNAME, version = Baubles.VERSION, dependencies="required-after:Forge@[10.12.0.1034,);") +@Mod(modid = Baubles.MODID, name = Baubles.MODNAME, version = Baubles.VERSION, dependencies="required-after:Forge@[10.12.0.1046,);") public class Baubles { public static final String MODID = "Baubles"; public static final String MODNAME = "Baubles"; - public static final String VERSION = "1.0.0.8"; + public static final String VERSION = "1.0.0.9"; @SidedProxy(clientSide = "baubles.client.ClientProxy", serverSide = "baubles.common.CommonProxy") public static CommonProxy proxy; diff --git a/src/main/java/baubles/common/event/KeyHandler.java b/src/main/java/baubles/common/event/KeyHandler.java index 884ba04..6accb1e 100644 --- a/src/main/java/baubles/common/event/KeyHandler.java +++ b/src/main/java/baubles/common/event/KeyHandler.java @@ -1,8 +1,5 @@ package baubles.common.event; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; @@ -25,29 +22,16 @@ public class KeyHandler { public KeyHandler() { ClientRegistry.registerKeyBinding(key); } - - boolean keyDown = false; @SideOnly(value=Side.CLIENT) @SubscribeEvent public void playerTick(PlayerTickEvent event) { if (event.side == Side.SERVER) return; if (event.phase == Phase.START ) { - if (GameSettings.isKeyDown(key)) - { - if (!keyDown) { - if (FMLClientHandler.instance().getClient().inGameHasFocus) { - Baubles.packetPipeline.sendToServer(new PacketOpenBaublesInventory(event.player)); - } else - if (Minecraft.getMinecraft().currentScreen!=null && - Minecraft.getMinecraft().currentScreen instanceof GuiContainer){ - Minecraft.getMinecraft().thePlayer.closeScreen(); - } - } - keyDown = true; - } else { - keyDown = false; - } + if (key.getIsKeyPressed() && FMLClientHandler.instance().getClient().inGameHasFocus) { + Baubles.packetPipeline.sendToServer(new PacketOpenBaublesInventory(event.player)); + } } } } + diff --git a/src/main/resources/changelog.txt b/src/main/resources/changelog.txt index a805f81..e013f09 100644 --- a/src/main/resources/changelog.txt +++ b/src/main/resources/changelog.txt @@ -1,3 +1,6 @@ +1.0.0.9 +- undoing the "baubles hotkey closes all inventories" change. It was messing with anything that allows text input + 1.0.0.8 - sync baubles itemstack data between client and server if changed outside the baubles GUI