From 40a97145dc1dd79f9836481713844d55a3e116bc Mon Sep 17 00:00:00 2001 From: Gig Date: Mon, 29 Jun 2015 23:18:21 +0100 Subject: [PATCH] fixed a important check --- src/main/java/techreborn/client/gui/GuiChargeBench.java | 7 +++++++ src/main/java/techreborn/tiles/TileChargeBench.java | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/techreborn/client/gui/GuiChargeBench.java b/src/main/java/techreborn/client/gui/GuiChargeBench.java index 455419d6e..8aebd94fd 100644 --- a/src/main/java/techreborn/client/gui/GuiChargeBench.java +++ b/src/main/java/techreborn/client/gui/GuiChargeBench.java @@ -37,6 +37,13 @@ public class GuiChargeBench extends GuiContainer { int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); + + int j = 0; + + j = chargebench.getEnergyScaled(12); + if(j > 0) { + this.drawTexturedModalRect(k + 10, l + 32 + 12 - j, 176, 12 - j, 14, j + 2); + } } protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { diff --git a/src/main/java/techreborn/tiles/TileChargeBench.java b/src/main/java/techreborn/tiles/TileChargeBench.java index f44076c47..b0c4b4731 100644 --- a/src/main/java/techreborn/tiles/TileChargeBench.java +++ b/src/main/java/techreborn/tiles/TileChargeBench.java @@ -25,8 +25,7 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn public BasicSink energy; public Inventory inventory = new Inventory(6, "TileChargeBench", 64); - public int capacity = 100000; - public int[] chargeSlot = {0, 1, 2, 3, 4, 5}; + public int capacity = 1000; public TileChargeBench(){ energy = new BasicSink(this, capacity, 3); @@ -45,7 +44,7 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn ItemStack stack = inventory.getStackInSlot(i); double MaxCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack); double CurrentCharge = ElectricItem.manager.getCharge(stack); - if(CurrentCharge != MaxCharge) + if(CurrentCharge != MaxCharge && energy.getEnergyStored() >= 128) { ElectricItem.manager.charge(stack, MaxCharge - CurrentCharge, 2, false, false); energy.useEnergy(128); @@ -177,6 +176,10 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn public boolean isItemValidForSlot(int slot, ItemStack stack) { return inventory.isItemValidForSlot(slot, stack); } + + public int getEnergyScaled(int scale) { + return (int)energy.getEnergyStored() * scale / energy.getCapacity(); + } // ISidedInventory // @Override