Add "No Power" error state

This commit is contained in:
mezz committed 2014-11-05 22:51:04 -08:00
1 parent 7d72a60f9b
commit 3a5275396b
9 files changed
+33 -2

No files matched your search

@@ -94,7 +94,9 @@ public enum EnumErrorCode {
NOSUPPLIES("noSupplies", "noResource", 32),
NOTRADE("noTrade", "noResource", 33);
NOTRADE("noTrade", "noResource", 33),
NOPOWER("noPower", "errored", 34);
private String name;
private String iconName;
@@ -232,6 +232,11 @@ public class MachineBottler extends TilePowered implements ISidedInventory, ILiq
checkRecipe();
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null)
setErrorState(EnumErrorCode.OK);
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
return;
}
}
@Override
@@ -356,6 +356,8 @@ public class MachineCarpenter extends TilePowered implements ISidedInventory, IL
setErrorState(EnumErrorCode.NORECIPE);
else if (!validateResources())
setErrorState(EnumErrorCode.NORESOURCE);
else if (energyManager.getTotalEnergyStored() == 0)
setErrorState(EnumErrorCode.NOPOWER);
else
setErrorState(EnumErrorCode.OK);
@@ -206,6 +206,11 @@ public class MachineCentrifuge extends TilePowered implements ISidedInventory, I
checkRecipe();
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null)
setErrorState(EnumErrorCode.OK);
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
return;
}
}
@Override
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import forestry.core.EnumErrorCode;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
@@ -328,6 +329,12 @@ public class MachineFabricator extends TilePowered implements ICrafter, ISpecial
}
this.dissipateHeat();
if (energyManager.getTotalEnergyStored() == 0 && heat == 0) {
setErrorState(EnumErrorCode.NOPOWER);
} else if (getErrorState() == EnumErrorCode.NOPOWER) {
setErrorState(EnumErrorCode.OK);
}
}
@Override
@@ -275,6 +275,8 @@ public class MachineFermenter extends TilePowered implements ISidedInventory, IL
setErrorState(EnumErrorCode.OK);
else if (inventory.getStackInSlot(SLOT_FUEL) == null && fuelBurnTime <= 0)
setErrorState(EnumErrorCode.NOFUEL);
else if (energyManager.getTotalEnergyStored() == 0)
setErrorState(EnumErrorCode.NOPOWER);
else
setErrorState(EnumErrorCode.NORECIPE);
}
@@ -253,6 +253,10 @@ public class MachineSqueezer extends TilePowered implements ISpecialInventory, I
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null)
setErrorState(EnumErrorCode.OK);
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
return;
}
}
@Override
@@ -212,6 +212,10 @@ public class MachineStill extends TilePowered implements ISpecialInventory, ISid
if (getErrorState() == EnumErrorCode.NORECIPE && currentRecipe != null)
setErrorState(EnumErrorCode.OK);
if (energyManager.getTotalEnergyStored() == 0) {
setErrorState(EnumErrorCode.NOPOWER);
return;
}
}
@Override