From 5f80e026c9afd7987daf5966c8a0d85aa2ae3fc4 Mon Sep 17 00:00:00 2001 From: James McKay Date: Wed, 26 Feb 2014 16:21:16 +1100 Subject: [PATCH] Fix opening and placement of armour GUI --- .../java/tconstruct/client/TControls.java | 47 ++----------------- .../client/gui/ArmorExtendedGui.java | 8 ++-- 2 files changed, 8 insertions(+), 47 deletions(-) diff --git a/src/main/java/tconstruct/client/TControls.java b/src/main/java/tconstruct/client/TControls.java index a2bf4283e20..e605ddc5a3e 100644 --- a/src/main/java/tconstruct/client/TControls.java +++ b/src/main/java/tconstruct/client/TControls.java @@ -155,55 +155,16 @@ void updateSize (String name, float size) updateServer(bos); } - public static void openInventoryGui () - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(3); - outputStream.writeByte(0); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - updateServer(bos); - } - public static void openArmorGui () { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(3); - outputStream.writeByte(1); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - updateServer(bos); + // Position is unused. Set to 0. + mc.thePlayer.openGui(TConstruct.instance, TProxyClient.armorGuiID, mc.theWorld, 0, 0, 0); } public static void openKnapsackGui () { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(3); - outputStream.writeByte(2); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - updateServer(bos); + // Position is unused. Set to 0. + mc.thePlayer.openGui(TConstruct.instance, TProxyClient.knapsackGuiID, mc.theWorld, 0, 0, 0); } static void updateServer (ByteArrayOutputStream bos) diff --git a/src/main/java/tconstruct/client/gui/ArmorExtendedGui.java b/src/main/java/tconstruct/client/gui/ArmorExtendedGui.java index 240addc3471..063f11d374a 100644 --- a/src/main/java/tconstruct/client/gui/ArmorExtendedGui.java +++ b/src/main/java/tconstruct/client/gui/ArmorExtendedGui.java @@ -37,7 +37,7 @@ public void initGui () super.initGui(); int cornerX = guiLeft; - int cornerY = (this.width - this.ySize) / 2; + int cornerY = guiTop; this.buttonList.clear(); // InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new @@ -48,7 +48,7 @@ public void initGui () // tab.enabled = false; // this.buttonList.add(tab); - TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabArmorExtended.class); + TabRegistry.updateTabValues(cornerX + 51, cornerY, InventoryTabArmorExtended.class); TabRegistry.addTabsToList(this.buttonList); } @@ -97,8 +97,8 @@ protected void drawGuiContainerBackgroundLayer (float f, int i, int j) // mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png"); this.mc.getTextureManager().bindTexture(background); int cornerX = guiLeft; - int cornerY = (width - ySize) / 2; - drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize); + int cornerY = guiTop; + drawTexturedModalRect(cornerX, guiTop, 0, 0, xSize, ySize); if (!stats.isStackInSlot(0)) drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);