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

Fixes not being able to pick up items from ME terminals when the network inventory is recalculated each tick for other reasons #5623

Merged
merged 1 commit into from Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/main/java/appeng/menu/me/common/IncrementalUpdateHelper.java
Expand Up @@ -74,12 +74,26 @@ public T getBySerial(long serial) {
return mapping.inverse().get(serial);
}

/**
* Clear pending changes and prepare for a full update.
* <p/>
* Mappings are kept because even in case of a full update, many items are usually still present and should keep
* their serial.
*/
public void clear() {
this.mapping.clear();
this.changes.clear();
fullUpdate = true;
}

/**
* Fully resets this helper into its initial state. This will also clear any serial mapping.
*/
public void reset() {
clear();
this.serial = 0;
this.mapping.clear();
}

public void addChange(T entry) {
// Ensure the stack size is not 0 to avoid deleting the mapping by mistake.
entry = IAEStack.copy(entry, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/menu/me/crafting/CraftingCPUMenu.java
Expand Up @@ -93,7 +93,7 @@ protected void setCPU(final ICraftingCPU c) {
this.cpu.craftingLogic.removeListener(cpuChangeListener);
}

this.incrementalUpdateHelper.clear();
this.incrementalUpdateHelper.reset();

if (c instanceof CraftingCPUCluster) {
this.cpu = (CraftingCPUCluster) c;
Expand Down