From 55ae375dd251ca6256616c4b00347dd122f55425 Mon Sep 17 00:00:00 2001 From: Andrew Dudney Date: Tue, 21 Oct 2014 16:29:26 -0600 Subject: [PATCH] Changed Math.min call to outside the loop so as to split power evenly between inputs when more energy is requested than can be output --- common/buildcraft/transport/pipes/PipePowerWood.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/common/buildcraft/transport/pipes/PipePowerWood.java b/common/buildcraft/transport/pipes/PipePowerWood.java index fd3eaa72..03c474c5 100644 --- a/common/buildcraft/transport/pipes/PipePowerWood.java +++ b/common/buildcraft/transport/pipes/PipePowerWood.java @@ -109,7 +109,7 @@ public class PipePowerWood extends Pipe implements IPowerRec return; } - int energyToRemove = requestedEnergy; + int energyToRemove = Math.min(battery.getEnergyStored(), requestedEnergy); // TODO: Have energyToRemove be precalculated // and used in receiveEnergy and extractEnergy. @@ -133,12 +133,8 @@ public class PipePowerWood extends Pipe implements IPowerRec } System.out.println("Sent " + energyToRemove + " energy to " + o.name()); - - int energyUsable = Math.min(battery.getEnergyStored(), energyToRemove); - - if (energyUsable > 0) { - battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyUsable)); - } + + battery.setEnergy(battery.getEnergyStored() - transport.receiveEnergy(o, energyToRemove)); } }