Merge pull request #666 from Flow86/patch-powerRequest

Fix bug in power distribution (Generic and Wooden Pipe)
This commit is contained in:
Flow86 2013-03-28 04:29:18 -07:00
commit a4e7e74d5e
2 changed files with 10 additions and 3 deletions

View file

@ -418,7 +418,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
@Override
public int powerRequest() {
return getPowerProvider().getMaxEnergyReceived();
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor)
return ((IPowerReceptor) pipe).powerRequest();
return 0;
}
@Override

View file

@ -108,9 +108,14 @@ public class PipePowerWood extends Pipe implements IPowerReceptor {
energyToRemove = 1;
}
float energyUsed = powerProvider.useEnergy(1, energyToRemove, true);
float energyUsable = powerProvider.useEnergy(1, energyToRemove, false);
trans.receiveEnergy(o.getOpposite(), energyUsed);
float energySend = Math.min(energyUsable, ((PipeTransportPower)transport).powerQuery[o.ordinal()]);
if(energySend > 0)
{
trans.receiveEnergy(o.getOpposite(), energySend);
powerProvider.useEnergy(1, energySend, true);
}
}
}
}