diff options
author | Sampsa <69092953+S4mpsa@users.noreply.github.com> | 2024-07-25 17:27:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-25 21:27:27 +0700 |
commit | f975d67f62c455533922d3d64d02b3b20b4543ba (patch) | |
tree | 801e107923a4ff9ffacf7290849608ca72147416 /src/main/java/gregtech/api | |
parent | 88812f7fcd8e33d0c7e57501dda7e043e0e14f47 (diff) | |
download | GT5-Unofficial-f975d67f62c455533922d3d64d02b3b20b4543ba.tar.gz GT5-Unofficial-f975d67f62c455533922d3d64d02b3b20b4543ba.tar.bz2 GT5-Unofficial-f975d67f62c455533922d3d64d02b3b20b4543ba.zip |
Add expedited recipe checks for autopulling Stocking Hatch and Bus (#2748)
* Add expedited recipe checks for autopulling Stocking Hatch and Bus
* Change to proper Item and FluidStack comparison operators
* Forgot one
* And a negation
* Spotless apply for branch stockingHatchNotifications for #2748 (#2765)
spotlessApply
Co-authored-by: GitHub GTNH Actions <>
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 58b82923f2..ff70633e7d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -105,6 +105,7 @@ import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_Output_ME; import gregtech.common.tileentities.machines.IDualInputHatch; import gregtech.common.tileentities.machines.IDualInputInventory; import gregtech.common.tileentities.machines.IRecipeProcessingAwareHatch; +import gregtech.common.tileentities.machines.ISmartInputHatch; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; import it.unimi.dsi.fastutil.objects.Object2ReferenceOpenHashMap; import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; @@ -148,6 +149,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity public ArrayList<GT_MetaTileEntity_Hatch_InputBus> mInputBusses = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_OutputBus> mOutputBusses = new ArrayList<>(); public ArrayList<IDualInputHatch> mDualInputHatches = new ArrayList<>(); + public ArrayList<ISmartInputHatch> mSmartInputHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_Dynamo> mDynamoHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_Muffler> mMufflerHatches = new ArrayList<>(); public ArrayList<GT_MetaTileEntity_Hatch_Energy> mEnergyHatches = new ArrayList<>(); @@ -390,6 +392,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity mMufflerHatches.clear(); mMaintenanceHatches.clear(); mDualInputHatches.clear(); + mSmartInputHatches.clear(); } public boolean checkStructure(boolean aForceReset) { @@ -514,6 +517,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity shouldCheck |= craftingInputMe.justUpdated(); } if (shouldCheck) return true; + // Do the same for Smart Input Hatches + for (ISmartInputHatch smartInputHatch : mSmartInputHatches) { + shouldCheck |= smartInputHatch.justUpdated(); + } + if (shouldCheck) return true; // Perform more frequent recipe change after the machine just shuts down. long timeElapsed = aTick - mLastWorkingTick; @@ -582,10 +590,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity } } } else { - if (shouldCheckRecipeThisTick(aTick) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() - || aBaseMetaTileEntity.hasInventoryBeenModified()) { + // Check if the machine is enabled in the first place! + if (aBaseMetaTileEntity.isAllowedToWork()) { - if (aBaseMetaTileEntity.isAllowedToWork()) { + if (shouldCheckRecipeThisTick(aTick) || aBaseMetaTileEntity.hasWorkJustBeenEnabled() + || aBaseMetaTileEntity.hasInventoryBeenModified()) { if (checkRecipe()) { markDirty(); } @@ -1593,6 +1602,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity hatch.updateCraftingIcon(this.getMachineCraftingIcon()); return mDualInputHatches.add(hatch); } + if (aMetaTileEntity instanceof ISmartInputHatch hatch) { + mSmartInputHatches.add(hatch); + } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { setHatchRecipeMap((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); @@ -1699,7 +1711,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity hatch.updateCraftingIcon(this.getMachineCraftingIcon()); return mDualInputHatches.add(hatch); } - + if (aMetaTileEntity instanceof ISmartInputHatch hatch) { + mSmartInputHatches.add(hatch); + } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus hatch) { hatch.updateTexture(aBaseCasingIndex); hatch.updateCraftingIcon(this.getMachineCraftingIcon()); @@ -1725,6 +1739,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity if (aTileEntity == null) return false; IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof ISmartInputHatch hatch) { + mSmartInputHatches.add(hatch); + } if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input hatch) { hatch.updateTexture(aBaseCasingIndex); hatch.updateCraftingIcon(this.getMachineCraftingIcon()); |