Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Stocking Buses running recipes while offline #2608

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public abstract class MetaTileEntityAEHostablePart<T extends IAEStack<T>> extend
private int meUpdateTick;
protected boolean isOnline;
private boolean allowExtraConnections;
protected boolean meStatusChanged = false;

public MetaTileEntityAEHostablePart(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch,
Class<? extends IStorageChannel<T>> storageChannel) {
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ public void update() {
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);
}
}
}
}

// Update the visual display for the fake items. This also is important for the item handler's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ public void update() {
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);
}

}
}
}

@Override
Expand Down