From dadcd12874b2a68be47899ececb27162b0a4ea0e Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sun, 13 Mar 2016 21:07:45 +0100 Subject: [PATCH] fix #3234 --- common/buildcraft/core/lib/block/TileBuildCraft.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/buildcraft/core/lib/block/TileBuildCraft.java b/common/buildcraft/core/lib/block/TileBuildCraft.java index 2e608fa6..33d8c01b 100644 --- a/common/buildcraft/core/lib/block/TileBuildCraft.java +++ b/common/buildcraft/core/lib/block/TileBuildCraft.java @@ -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; }