Move NOPOWER error check to TilePowered updateEntity

This commit is contained in:
mezz committed 2015-03-23 23:35:05 -07:00
1 parent 97a96b8f3f
commit 6593d75234
5 files changed
+10 -23

No files matched your search

@@ -185,11 +185,6 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
return;
}
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
return;
}
setErrorState(EnumErrorCode.OK);
}
@@ -16,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional;
import forestry.core.EnumErrorCode;
import forestry.core.interfaces.IPowerHandler;
import forestry.core.interfaces.IRenderableMachine;
import forestry.core.proxy.Proxies;
@@ -63,13 +64,16 @@ public abstract class TilePowered extends TileBase implements IRenderableMachine
return;
}
if (workCounter < WORK_CYCLES && energyManager.consumeEnergyToDoWork()) {
workCounter++;
}
if (workCounter >= WORK_CYCLES && updateOnInterval(5)) {
if (workCycle()) {
if (workCounter < WORK_CYCLES) {
if (energyManager.consumeEnergyToDoWork()) {
workCounter++;
} else {
setErrorState(EnumErrorCode.NOPOWER);
}
} else {
if (updateOnInterval(5) && workCycle()) {
workCounter = 0;
setErrorState(EnumErrorCode.OK);
}
}
}
@@ -244,10 +244,6 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null) {
setErrorState(EnumErrorCode.OK);
}
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
}
}
@Override
@@ -222,10 +222,6 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory {
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null) {
setErrorState(EnumErrorCode.OK);
}
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
}
}
@Override
@@ -227,10 +227,6 @@ public class MachineSqueezer extends TilePowered implements ISidedInventory, ILi
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null) {
setErrorState(EnumErrorCode.OK);
}
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
}
}
@Override