diff --git a/common/mekanism/common/TileEntityAdvancedElectricMachine.java b/common/mekanism/common/TileEntityAdvancedElectricMachine.java index e4bfb15d3..a6526cc2c 100644 --- a/common/mekanism/common/TileEntityAdvancedElectricMachine.java +++ b/common/mekanism/common/TileEntityAdvancedElectricMachine.java @@ -127,36 +127,28 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM handleSecondaryFuel(); - if(electricityStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK) && secondaryEnergyStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK)) + if(canOperate() && electricityStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK) && secondaryEnergyStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK)) { - if(canOperate() && (operatingTicks+1) < MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED) && secondaryEnergyStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK)) - { - operatingTicks++; - secondaryEnergyStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK); - electricityStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK); - } - else if((operatingTicks+1) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) + setActive(true); + operatingTicks++; + secondaryEnergyStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK); + electricityStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK); + + if((operatingTicks) >= MekanismUtils.getTicks(speedMultiplier, TICKS_REQUIRED)) { operate(); operatingTicks = 0; - secondaryEnergyStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK); - electricityStored -= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK); } } + else { + setActive(false); + } if(!canOperate()) { operatingTicks = 0; } - - if(canOperate() && electricityStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, ENERGY_PER_TICK) && secondaryEnergyStored >= MekanismUtils.getEnergyPerTick(speedMultiplier, energyMultiplier, SECONDARY_ENERGY_PER_TICK)) - { - setActive(true); - } - else { - setActive(false); - } } }