diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java index fbe7e8ff674..6212144fec7 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityAEHostablePart.java @@ -45,6 +45,7 @@ public abstract class MetaTileEntityAEHostablePart> extend private int meUpdateTick; protected boolean isOnline; private boolean allowExtraConnections; + protected boolean meStatusChanged = false; public MetaTileEntityAEHostablePart(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch, Class> storageChannel) { @@ -158,6 +159,9 @@ public boolean updateMEStatus() { if (this.isOnline != isOnline) { writeCustomData(UPDATE_ONLINE_STATUS, buf -> buf.writeBoolean(isOnline)); this.isOnline = isOnline; + this.meStatusChanged = true; + } else { + this.meStatusChanged = false; } } return this.isOnline; diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java index 640f7869617..70fb8de03c3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java @@ -64,9 +64,22 @@ protected ExportOnlyAEStockingItemList getAEItemHandler() { @Override public void update() { super.update(); - if (!getWorld().isRemote && isWorkingEnabled() && autoPull && getOffsetTimer() % 100 == 0) { - refreshList(); - syncME(); + if (!getWorld().isRemote) { + if (isWorkingEnabled() && autoPull && getOffsetTimer() % 100 == 0) { + refreshList(); + syncME(); + } + + // Immediately clear cached items if the status changed, to prevent running recipes while offline + if (this.meStatusChanged && !this.isOnline) { + if (autoPull) { + clearInventory(0); + } else { + for (int i = 0; i < CONFIG_SIZE; i++) { + getAEItemHandler().getInventory()[i].setStack(null); + } + } + } } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java index 30e28eff54b..f751a05a7a3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java @@ -64,9 +64,22 @@ protected ExportOnlyAEStockingFluidList getAEFluidHandler() { @Override public void update() { super.update(); - if (!getWorld().isRemote && isWorkingEnabled() && autoPull && getOffsetTimer() % 100 == 0) { - refreshList(); - syncME(); + if (!getWorld().isRemote) { + if (isWorkingEnabled() && autoPull && getOffsetTimer() % 100 == 0) { + refreshList(); + syncME(); + } + + // Immediately clear cached fluids if the status changed, to prevent running recipes while offline + if (this.meStatusChanged && !this.isOnline) { + if (autoPull) { + this.getAEFluidHandler().clearConfig(); + } else { + for (int i = 0; i < CONFIG_SIZE; i++) { + getAEFluidHandler().getInventory()[i].setStack(null); + } + } + } } }