TileGenericPipe.java:

- fixes not calling powerRequest of IPowerReceptor-Pipe

PipePowerWood.java:
- fixes exploding pipes directly behind of a wooden pipe if no power-consumer exists, instead it will only extract the power amount which is requested by the consumers
This commit is contained in:
FloSoft 2013-03-05 18:02:49 +01:00
parent 55660989e4
commit 324242bfea
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);
}
}
}
}