diff --git a/common/crazypants/enderio/power/PowerInterfaceRF.java b/common/crazypants/enderio/power/PowerInterfaceRF.java index bea37ecc..f9aaa9cb 100644 --- a/common/crazypants/enderio/power/PowerInterfaceRF.java +++ b/common/crazypants/enderio/power/PowerInterfaceRF.java @@ -17,7 +17,7 @@ public class PowerInterfaceRF implements IPowerInterface { @Override public boolean canConduitConnect(ForgeDirection direction) { - if(rfPower != null) { + if(rfPower != null && direction != null) { return rfPower.canInterface(direction.getOpposite()); } return false; @@ -25,7 +25,7 @@ public class PowerInterfaceRF implements IPowerInterface { @Override public float getEnergyStored(ForgeDirection dir) { - if(rfPower != null) { + if(rfPower != null && dir != null) { return rfPower.getEnergyStored(dir) / 10f; } return 0; @@ -33,7 +33,7 @@ public class PowerInterfaceRF implements IPowerInterface { @Override public float getMaxEnergyStored(ForgeDirection dir) { - if(rfPower != null) { + if(rfPower != null && dir != null) { return rfPower.getMaxEnergyStored(dir) / 10f; } return 0; @@ -54,7 +54,7 @@ public class PowerInterfaceRF implements IPowerInterface { @Override public float recieveEnergy(ForgeDirection opposite, float canOffer) { - if(rfPower != null) { + if(rfPower != null && opposite != null) { return rfPower.receiveEnergy(opposite, (int) (canOffer * 10), false) / 10f; } return 0; diff --git a/common/crazypants/util/ItemUtil.java b/common/crazypants/util/ItemUtil.java index 6d0fea09..a04214ab 100644 --- a/common/crazypants/util/ItemUtil.java +++ b/common/crazypants/util/ItemUtil.java @@ -67,14 +67,14 @@ public class ItemUtil { if(inserted > 0) { numInserted += inserted; - numToInsert -= inserted; - sidedInv.setInventorySlotContents(slot, toInsert); + numToInsert -= inserted; + sidedInv.setInventorySlotContents(slot, toInsert); } } } } - if(numInserted > 0) { - sidedInv.onInventoryChanged(); + if(numInserted > 0) { + sidedInv.onInventoryChanged(); } return numInserted; } @@ -104,13 +104,13 @@ public class ItemUtil { if(inserted > 0) { numInserted += inserted; - numToInsert -= inserted; - inv.setInventorySlotContents(slot, toInsert); + numToInsert -= inserted; + inv.setInventorySlotContents(slot, toInsert); } } } - if(numInserted > 0) { - inv.onInventoryChanged(); + if(numInserted > 0) { + inv.onInventoryChanged(); } return numInserted; }