This commit is contained in:
asiekierka 2016-03-13 21:07:45 +01:00
parent 0de4f15598
commit dadcd12874

View file

@ -186,7 +186,7 @@ public abstract class TileBuildCraft extends TileEntity implements IEnergyHandle
public int receiveEnergy(ForgeDirection from, int maxReceive,
boolean simulate) {
if (battery != null && this.canConnectEnergy(from)) {
int received = battery.receiveEnergy(maxReceive - receivedTick, simulate);
int received = battery.receiveEnergy(Math.min(maxReceive, battery.getMaxEnergyReceive() - receivedTick), simulate);
if (!simulate) {
receivedTick += received;
worldTimeEnergyReceive = worldObj.getTotalWorldTime();
@ -203,7 +203,7 @@ public abstract class TileBuildCraft extends TileEntity implements IEnergyHandle
public int extractEnergy(ForgeDirection from, int maxExtract,
boolean simulate) {
if (battery != null && this.canConnectEnergy(from)) {
int extracted = battery.extractEnergy(maxExtract - extractedTick, simulate);
int extracted = battery.extractEnergy(Math.min(maxExtract, battery.getMaxEnergyExtract() - extractedTick), simulate);
if (!simulate) {
extractedTick += extracted;
}