Merge remote-tracking branch 'remotes/origin/patch-powerRequest' into patch-renderPipe

closes #666
This commit is contained in:
Flow86 2013-03-28 12:26:02 +01:00
commit 4a8f1654c5
2 changed files with 10 additions and 3 deletions

View file

@ -407,7 +407,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

@ -114,9 +114,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);
}
}
}
}