fixed a important check

This commit is contained in:
Gig 2015-06-29 23:18:21 +01:00
parent 6c61829ddc
commit 40a97145dc
2 changed files with 13 additions and 3 deletions

View file

@ -37,6 +37,13 @@ public class GuiChargeBench extends GuiContainer {
int k = (this.width - this.xSize) / 2; int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2; int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); 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_) { protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {

View file

@ -25,8 +25,7 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn
public BasicSink energy; public BasicSink energy;
public Inventory inventory = new Inventory(6, "TileChargeBench", 64); public Inventory inventory = new Inventory(6, "TileChargeBench", 64);
public int capacity = 100000; public int capacity = 1000;
public int[] chargeSlot = {0, 1, 2, 3, 4, 5};
public TileChargeBench(){ public TileChargeBench(){
energy = new BasicSink(this, capacity, 3); energy = new BasicSink(this, capacity, 3);
@ -45,7 +44,7 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn
ItemStack stack = inventory.getStackInSlot(i); ItemStack stack = inventory.getStackInSlot(i);
double MaxCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack); double MaxCharge = ((IElectricItem) stack.getItem()).getMaxCharge(stack);
double CurrentCharge = ElectricItem.manager.getCharge(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); ElectricItem.manager.charge(stack, MaxCharge - CurrentCharge, 2, false, false);
energy.useEnergy(128); energy.useEnergy(128);
@ -178,6 +177,10 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn
return inventory.isItemValidForSlot(slot, stack); return inventory.isItemValidForSlot(slot, stack);
} }
public int getEnergyScaled(int scale) {
return (int)energy.getEnergyStored() * scale / energy.getCapacity();
}
// ISidedInventory // ISidedInventory
// @Override // @Override
// public int[] getAccessibleSlotsFromSide(int side) // public int[] getAccessibleSlotsFromSide(int side)