fixed a important check
This commit is contained in:
parent
6c61829ddc
commit
40a97145dc
2 changed files with 13 additions and 3 deletions
|
@ -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_) {
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -177,6 +176,10 @@ public class TileChargeBench extends TileMachineBase implements IWrenchable, IEn
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue