2525import java .util .List ;
2626import java .util .stream .IntStream ;
2727
28+ import static gregtech .api .situation .Situations .*;
29+
2830public class MetaTileEntityAirCollector extends TieredMetaTileEntity {
2931 private static final int PRODUCTION_CYCLE_LENGTH = 20 ;
3032
@@ -48,12 +50,19 @@ public void update() {
4850
4951 if (!getWorld ().isRemote ) {
5052 long energyToConsume = GTValues .V [getTier ()];
51- if (checkDimension () && checkOpenSides () && getTimer () % PRODUCTION_CYCLE_LENGTH == 0L && energyContainer .getEnergyStored () >= energyToConsume ) {
52- int fluidAmount = getCollectedFluidAmount ();
53- FluidStack fluidStack = Materials .Air .getFluid (fluidAmount );
54- if (exportFluids .fill (fluidStack , false ) == fluidAmount ) {
55- exportFluids .fill (fluidStack , true );
56- energyContainer .removeEnergy (energyToConsume );
53+ if (getTimer () % PRODUCTION_CYCLE_LENGTH == 0L ) {
54+ if (energyContainer .getEnergyStored () >= energyToConsume ) {
55+ if (checkDimension () && checkOpenSides ()) {
56+ this .setSituation (WORKING );
57+ int fluidAmount = getCollectedFluidAmount ();
58+ FluidStack fluidStack = Materials .Air .getFluid (fluidAmount );
59+ if (exportFluids .fill (fluidStack , false ) == fluidAmount ) {
60+ exportFluids .fill (fluidStack , true );
61+ energyContainer .removeEnergy (energyToConsume );
62+ }
63+ }
64+ } else {
65+ setSituation (INSUFFICIENT_POWER_TO_START );
5766 }
5867 }
5968 if (getTimer () % 5 == 0 ) {
@@ -69,12 +78,15 @@ private boolean checkOpenSides() {
6978 if (getWorld ().isAirBlock (getPos ().offset (side )))
7079 return true ;
7180 }
81+ setSituation (BLOCKED_INTAKES );
7282 return false ;
7383 }
7484
7585 private boolean checkDimension () {
7686 int dimensionId = getWorld ().provider .getDimension ();
77- return IntStream .of (ConfigHolder .machineSpecific .airCollectorDimensionBlacklist ).noneMatch (x -> x == dimensionId );
87+ boolean air = IntStream .of (ConfigHolder .machineSpecific .airCollectorDimensionBlacklist ).noneMatch (x -> x == dimensionId );
88+ if (!air ) setSituation (DIMENSION_LACKS_ATMOSPHERE );
89+ return air ;
7890 }
7991
8092 private int getCollectedFluidAmount () {
0 commit comments