Merge pull request #1848 from Prototik/energy-converter-crash

Energy converter crash
This commit is contained in:
SpaceToad 2014-05-25 12:47:43 +02:00
commit ae43e9cdb9

View file

@ -139,6 +139,9 @@ public class TileEnergyConverter extends TileBuildCraft implements IPowerRecepto
if (tile instanceof IPowerReceptor && mjStored > 0) { if (tile instanceof IPowerReceptor && mjStored > 0) {
IPowerReceptor receptor = (IPowerReceptor) tile; IPowerReceptor receptor = (IPowerReceptor) tile;
PowerHandler.PowerReceiver powerReceiver = receptor.getPowerReceiver(side.getOpposite()); PowerHandler.PowerReceiver powerReceiver = receptor.getPowerReceiver(side.getOpposite());
if (powerReceiver == null) {
continue;
}
double wantToUse = Math.min(mjStored, powerReceiver.getMaxEnergyReceived()); double wantToUse = Math.min(mjStored, powerReceiver.getMaxEnergyReceived());
if (wantToUse > powerReceiver.getMinEnergyReceived()) { if (wantToUse > powerReceiver.getMinEnergyReceived()) {
powerReceiver.receiveEnergy(PowerHandler.Type.MACHINE, wantToUse, side); powerReceiver.receiveEnergy(PowerHandler.Type.MACHINE, wantToUse, side);