From 083696280c6e99b530784a96d57d6ade83493d47 Mon Sep 17 00:00:00 2001 From: Tntrololol Date: Sun, 14 Jun 2015 13:34:52 -0500 Subject: [PATCH] Some GUI fixes --- .../techreborn/client/gui/GuiAlloySmelter.java | 10 +++++----- .../client/gui/GuiAssemblingMachine.java | 14 +++++++------- .../techreborn/client/gui/GuiCentrifuge.java | 14 +++++++------- .../client/gui/GuiChemicalReactor.java | 10 +++++----- .../java/techreborn/client/gui/GuiGrinder.java | 8 ++++---- .../client/gui/GuiIndustrialSawmill.java | 16 +++++++++------- .../java/techreborn/client/gui/GuiLathe.java | 10 +++++----- .../client/gui/GuiPlateCuttingMachine.java | 10 +++++----- .../java/techreborn/tiles/TileAlloySmelter.java | 11 +++++++++++ .../techreborn/tiles/TileAssemblingMachine.java | 11 +++++++++++ .../java/techreborn/tiles/TileCentrifuge.java | 11 +++++++++++ .../techreborn/tiles/TileChemicalReactor.java | 11 +++++++++++ src/main/java/techreborn/tiles/TileGrinder.java | 11 +++++++++++ .../tiles/TileImplosionCompressor.java | 12 ++++++++++++ .../techreborn/tiles/TileIndustrialSawmill.java | 13 ++++++++++++- src/main/java/techreborn/tiles/TileLathe.java | 11 +++++++++++ .../tiles/TilePlateCuttingMachine.java | 11 +++++++++++ 17 files changed, 148 insertions(+), 46 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java index 4c755e090..559709408 100644 --- a/src/main/java/techreborn/client/gui/GuiAlloySmelter.java +++ b/src/main/java/techreborn/client/gui/GuiAlloySmelter.java @@ -40,12 +40,12 @@ public class GuiAlloySmelter extends GuiContainer { int j = 0; - if(alloysmelter.crafter.currentTickTime != 0) { - j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16); + j = alloysmelter.getProgressScaled(24); + if(j > 0) { + this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16); + } - j = (int)this.alloysmelter.energy.getEnergyStored() * 12 / this.alloysmelter.energy.getCapacity(); + j = alloysmelter.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java index 2d8123d68..2a33c7d46 100644 --- a/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiAssemblingMachine.java @@ -42,14 +42,14 @@ public class GuiAssemblingMachine extends GuiContainer { int j = 0; - if(this.assemblingmachine.crafter.currentTickTime != 0){ - j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16); - - j = (int) (this.assemblingmachine.energy.getEnergyStored() * 12 / this.assemblingmachine.energy.getCapacity()); + j = assemblingmachine.getProgressScaled(20); if(j > 0) { - this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); + this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16); + } + + j = assemblingmachine.getEnergyScaled(12); + if(j > 0) { + this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } } diff --git a/src/main/java/techreborn/client/gui/GuiCentrifuge.java b/src/main/java/techreborn/client/gui/GuiCentrifuge.java index eb5a779cf..72639520e 100644 --- a/src/main/java/techreborn/client/gui/GuiCentrifuge.java +++ b/src/main/java/techreborn/client/gui/GuiCentrifuge.java @@ -40,15 +40,15 @@ public class GuiCentrifuge extends GuiContainer { int j = 0; - if(centrifuge.crafter.currentRecipe != null) { - j = this.centrifuge.crafter.currentTickTime * 11 / this.centrifuge.crafter.currentNeededTicks; + j = centrifuge.getProgressScaled(11); + if(j > 0) { + this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j); + this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10); + this.drawTexturedModalRect(k + 83, l + 53, 177, 39, 10, j); + this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10); } - this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j); - this.drawTexturedModalRect(k + 98, l + 38, 177, 51, j, 10); - this.drawTexturedModalRect(k + 83, l + 53, 177, 39, 10, j); - this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10); - j = (int)this.centrifuge.energy.getEnergyStored() * 12 / this.centrifuge.energy.getCapacity(); + j = centrifuge.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java index ed583da5f..49a209145 100644 --- a/src/main/java/techreborn/client/gui/GuiChemicalReactor.java +++ b/src/main/java/techreborn/client/gui/GuiChemicalReactor.java @@ -42,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer { int j = 0; - if(this.chemicalReactor.crafter.currentTickTime != 0){ - j = this.chemicalReactor.crafter.currentTickTime * 20 / this.chemicalReactor.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); + j = chemicalReactor.getProgressScaled(11); + if(j > 0) { + this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j); + } - j = (int) (this.chemicalReactor.crafter.energy.getEnergyStored() * 12 / this.chemicalReactor.energy.getCapacity()); + j = chemicalReactor.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiGrinder.java b/src/main/java/techreborn/client/gui/GuiGrinder.java index b4a63d48b..d96b41924 100644 --- a/src/main/java/techreborn/client/gui/GuiGrinder.java +++ b/src/main/java/techreborn/client/gui/GuiGrinder.java @@ -33,12 +33,12 @@ public class GuiGrinder extends GuiContainer{ int j = 0; - if(grinder.crafter.currentRecipe != null) { - j = this.grinder.crafter.currentTickTime * 24 / this.grinder.crafter.currentNeededTicks; + j = grinder.getProgressScaled(24); + if(j > 0) { + this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j + 1, 16); } - this.drawTexturedModalRect(k + 51, l + 35, 176, 14, j + 1, 16); - j = (int)this.grinder.energy.getEnergyStored() * 12 / this.grinder.energy.getCapacity(); + j = grinder.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java index 47d41d326..11f54a403 100644 --- a/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java +++ b/src/main/java/techreborn/client/gui/GuiIndustrialSawmill.java @@ -46,15 +46,17 @@ public class GuiIndustrialSawmill extends GuiContainer { int j = 0; - if(sawmill.crafter.currentTickTime != 0) { - j = this.sawmill.crafter.currentTickTime * 24 / this.sawmill.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 57, l + 36, 176, 11, j - 1, 13); - - j = (int)this.sawmill.energy.getEnergyStored() * 12 / this.sawmill.energy.getCapacity(); + j = sawmill.getProgressScaled(24); if(j > 0) { - this.drawTexturedModalRect(k + 36, l + 66 + 12 - j, 176, 12 - j, 14, j + 2); + this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j - 1, 11); } + + + j = sawmill.getEnergyScaled(12); + if(j > 0) { + this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2); + } + } protected void drawGuiContainerForegroundLayer(int p_146979_1_, diff --git a/src/main/java/techreborn/client/gui/GuiLathe.java b/src/main/java/techreborn/client/gui/GuiLathe.java index a9a96edb6..2cfd12733 100644 --- a/src/main/java/techreborn/client/gui/GuiLathe.java +++ b/src/main/java/techreborn/client/gui/GuiLathe.java @@ -42,12 +42,12 @@ public class GuiLathe extends GuiContainer { int j = 0; - if(this.lathe.crafter.currentTickTime != 0){ - j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16); + j = lathe.getProgressScaled(20); + if(j > 0) { + this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16); + } - j = (int) (this.lathe.energy.getEnergyStored() * 12 / this.lathe.energy.getCapacity()); + j = lathe.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java b/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java index ebe8768e8..86241e335 100644 --- a/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java +++ b/src/main/java/techreborn/client/gui/GuiPlateCuttingMachine.java @@ -43,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer { int j = 0; - if(this.platecuttingmachine.crafter.currentTickTime != 0){ - j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentNeededTicks; - } - this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16); + j = platecuttingmachine.getProgressScaled(20); + if(j > 0) { + this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16); + } - j = (int) (this.platecuttingmachine.energy.getEnergyStored() * 12 / this.platecuttingmachine.energy.getCapacity()); + j = platecuttingmachine.getEnergyScaled(12); if(j > 0) { this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2); } diff --git a/src/main/java/techreborn/tiles/TileAlloySmelter.java b/src/main/java/techreborn/tiles/TileAlloySmelter.java index 4fb0250d6..9b103d270 100644 --- a/src/main/java/techreborn/tiles/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/TileAlloySmelter.java @@ -200,4 +200,15 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE { return slotIndex == 2; } + + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } } diff --git a/src/main/java/techreborn/tiles/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/TileAssemblingMachine.java index 192927c28..386fb7c5b 100644 --- a/src/main/java/techreborn/tiles/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/TileAssemblingMachine.java @@ -209,4 +209,15 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl // } // } + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + } diff --git a/src/main/java/techreborn/tiles/TileCentrifuge.java b/src/main/java/techreborn/tiles/TileCentrifuge.java index 5e117654b..63b8986f9 100644 --- a/src/main/java/techreborn/tiles/TileCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileCentrifuge.java @@ -216,4 +216,15 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn { return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5; } + + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } } \ No newline at end of file diff --git a/src/main/java/techreborn/tiles/TileChemicalReactor.java b/src/main/java/techreborn/tiles/TileChemicalReactor.java index 9041fb407..add2a6fc1 100644 --- a/src/main/java/techreborn/tiles/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/TileChemicalReactor.java @@ -209,4 +209,15 @@ public class TileChemicalReactor extends TileMachineBase implements IWrenchable, // } // } + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + } diff --git a/src/main/java/techreborn/tiles/TileGrinder.java b/src/main/java/techreborn/tiles/TileGrinder.java index ed0302a1c..d52a55fc5 100644 --- a/src/main/java/techreborn/tiles/TileGrinder.java +++ b/src/main/java/techreborn/tiles/TileGrinder.java @@ -241,4 +241,15 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy { return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5; } + + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } } diff --git a/src/main/java/techreborn/tiles/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/TileImplosionCompressor.java index d02f8b6fe..f6cb6d706 100644 --- a/src/main/java/techreborn/tiles/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/TileImplosionCompressor.java @@ -202,4 +202,16 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha { return slotIndex == 2 || slotIndex == 3; } + + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + } diff --git a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java index 6b34178f7..99a9c7302 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/TileIndustrialSawmill.java @@ -130,7 +130,7 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl public void addWailaInfo(List info) { super.addWailaInfo(info); - info.add("Power Stored " + energy.getEnergyStored() +" EU"); + info.add("Power Stored " + energy.getEnergyStored() + " EU"); if(crafter.currentRecipe !=null){ info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t"); } @@ -263,4 +263,15 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl return slotIndex == 2 || slotIndex == 3 || slotIndex == 4; } + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + } diff --git a/src/main/java/techreborn/tiles/TileLathe.java b/src/main/java/techreborn/tiles/TileLathe.java index 3ecf02b1c..367f77b31 100644 --- a/src/main/java/techreborn/tiles/TileLathe.java +++ b/src/main/java/techreborn/tiles/TileLathe.java @@ -208,4 +208,15 @@ public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTi // } // } + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + } diff --git a/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java b/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java index a612ead13..c52448035 100644 --- a/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java +++ b/src/main/java/techreborn/tiles/TilePlateCuttingMachine.java @@ -208,5 +208,16 @@ public class TilePlateCuttingMachine extends TileMachineBase implements IWrencha return slotIndex == 1; } + public int getProgressScaled(int scale) { + if(crafter.currentTickTime != 0) { + return crafter.currentTickTime * scale / crafter.currentNeededTicks; + } + return 0; + } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } + }