Added ability to increase output threshhold of modular battery by multi-blocking it

This commit is contained in:
Calclavia 2013-10-26 18:09:23 +08:00
parent 37f4669ac4
commit 2596dfb1c5
3 changed files with 11 additions and 8 deletions

@ -1 +1 @@
Subproject commit caa413c164c8f545dc5a7583f5bc3c57dc252b0e Subproject commit e78a1934782b3d24d9ec2c501f7896c4dbc3c15c

View file

@ -217,7 +217,7 @@ public class TileEntityAdvancedFurnace extends TileEntityFurnace implements IEle
@Override @Override
public float getRequest(ForgeDirection direction) public float getRequest(ForgeDirection direction)
{ {
if (this.canSmelt() && this.getStackInSlot(1) == null) if (this.canSmelt() && this.getStackInSlot(1) == null && this.furnaceBurnTime == 0)
{ {
return ResonantInduction.FURNACE_WATTAGE / 20; return ResonantInduction.FURNACE_WATTAGE / 20;
} }

View file

@ -49,8 +49,6 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
private EnumSet inputSides = EnumSet.allOf(ForgeDirection.class); private EnumSet inputSides = EnumSet.allOf(ForgeDirection.class);
private float transferThreshold = 50;
@Override @Override
public void updateEntity() public void updateEntity()
{ {
@ -83,7 +81,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
IItemElectric battery = (IItemElectric) itemStack.getItem(); IItemElectric battery = (IItemElectric) itemStack.getItem();
float energyStored = getMaxEnergyStored(); float energyStored = getMaxEnergyStored();
float batteryNeeded = battery.recharge(itemStack, provideElectricity(this.transferThreshold, false).getWatts(), false); float batteryNeeded = battery.recharge(itemStack, provideElectricity(this.getTransferThreshhold(), false).getWatts(), false);
float toGive = Math.min(energyStored, Math.min(battery.getTransfer(itemStack), batteryNeeded)); float toGive = Math.min(energyStored, Math.min(battery.getTransfer(itemStack), batteryNeeded));
battery.recharge(itemStack, provideElectricity(toGive, true).getWatts(), true); battery.recharge(itemStack, provideElectricity(toGive, true).getWatts(), true);
} }
@ -95,7 +93,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
float energyNeeded = getMaxEnergyStored() - getEnergyStored(); float energyNeeded = getMaxEnergyStored() - getEnergyStored();
float batteryStored = battery.getElectricityStored(itemStack); float batteryStored = battery.getElectricityStored(itemStack);
float toReceive = Math.min(energyNeeded, Math.min(this.transferThreshold, Math.min(battery.getTransfer(itemStack), batteryStored))); float toReceive = Math.min(energyNeeded, Math.min(this.getTransferThreshhold(), Math.min(battery.getTransfer(itemStack), batteryStored)));
battery.discharge(itemStack, receiveElectricity(toReceive, true), true); battery.discharge(itemStack, receiveElectricity(toReceive, true), true);
} }
@ -127,6 +125,11 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
this.produce(); this.produce();
} }
} }
public float getTransferThreshhold()
{
return this.structure.getVolume() * 50;
}
public void updateClient() public void updateClient()
{ {
@ -598,7 +601,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
{ {
if (this.getInputDirections().contains(direction)) if (this.getInputDirections().contains(direction))
{ {
return Math.min(this.getMaxEnergyStored() - this.getEnergyStored(), this.transferThreshold); return Math.min(this.getMaxEnergyStored() - this.getEnergyStored(), this.getTransferThreshhold());
} }
return 0; return 0;
} }
@ -608,7 +611,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
{ {
if (this.getOutputDirections().contains(direction)) if (this.getOutputDirections().contains(direction))
{ {
return Math.min(this.getEnergyStored(), this.transferThreshold); return Math.min(this.getEnergyStored(), this.getTransferThreshhold());
} }
return 0; return 0;