Skip to content

Commit

Permalink
Fix Stocking Buses running recipes while offline
Browse files Browse the repository at this point in the history
  • Loading branch information
ALongStringOfNumbers committed Sep 4, 2024
1 parent cc0e414 commit 1f000c2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public abstract class MetaTileEntityAEHostablePart<T extends IAEStack<T>> extend
private AENetworkProxy aeProxy;
private int meUpdateTick;
protected boolean isOnline;
protected boolean meStatusChanged = false;

public MetaTileEntityAEHostablePart(ResourceLocation metaTileEntityId, int tier, boolean isExportHatch,
Class<? extends IStorageChannel<T>> storageChannel) {
Expand Down Expand Up @@ -152,6 +153,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,11 @@ public void update() {
refreshList();
syncME();
}

// Immediately Sync if the status changed, to prevent running recipes while offline
if (this.meStatusChanged && !this.isOnline) {
syncME();
}
}

// 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,11 @@ public void update() {
refreshList();
syncME();
}

// Immediately Sync if the status changed, to prevent running recipes while offline
if (this.meStatusChanged && !this.isOnline) {
syncME();
}
}

@Override
Expand Down

0 comments on commit 1f000c2

Please sign in to comment.