Skip to content

Commit

Permalink
Fix broken digital singularities (#537)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
kuba6000 and Dream-Master authored Jul 30, 2024
1 parent 0648d16 commit 7634deb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ public void getListOfItem(final IItemList<IAEItemStack> list, final CraftingItem
}

public void addStorage(final IAEItemStack extractItems) {
extractItems.setCraftable(false);
this.inventory.injectItems(extractItems, Actionable.MODULATE, null);
}

Expand Down Expand Up @@ -1121,6 +1122,10 @@ void done() {
public void readFromNBT(final NBTTagCompound data) {
this.finalOutput = AEItemStack.loadItemStackFromNBT((NBTTagCompound) data.getTag("finalOutput"));
for (final IAEItemStack ais : this.readList((NBTTagList) data.getTag("inventory"))) {
if (ais.isCraftable() && ais.getStackSize() == 0) // remove bugged items from CPU Clusters, they are
// spamming injectItems every tick
continue;
ais.setCraftable(false);
this.inventory.injectItems(ais, Actionable.MODULATE, this.machineSrc);
}

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/appeng/me/storage/CellInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AELog;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
Expand Down Expand Up @@ -185,6 +186,13 @@ public IAEItemStack injectItems(final IAEItemStack input, final Actionable mode,
}
}

if (input.isCraftable()) {
AELog.error(
new Throwable(),
"FATAL: DETECTED ILLEGAL ITEM TO BE INSERTED ON STORAGE CELL, PLEASE REPORT ON GITHUB! STACKTRACE:");
input.setCraftable(false);
}

final IAEItemStack l = this.getCellItems().findPrecise(input);

if (l != null) {
Expand Down Expand Up @@ -391,6 +399,11 @@ private void loadCellItems() {
}
}
}

if (this.cellItems.size() != types) {
// fix broken singularity cells
this.saveChanges();
}
}

@Override
Expand Down

0 comments on commit 7634deb

Please sign in to comment.