Skip to content

Commit

Permalink
Only show decompression patterns up to the most compressed available …
Browse files Browse the repository at this point in the history
…variant
  • Loading branch information
62832 committed Jun 2, 2023
1 parent 54242d9 commit 3121be7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class BulkCellInventory implements StorageCell {
private final Object2IntMap<AEItemKey> compressed;
private final Object2IntMap<AEItemKey> decompressed;
private BigInteger unitCount;
private AEItemKey highestCompressed;
private final long unitFactor;
public final boolean compressionEnabled;

Expand All @@ -65,6 +66,7 @@ public BulkCellInventory(MEGABulkCell cell, ItemStack o, ISaveProvider container

this.storedItem = getTag().contains(KEY) ? AEItemKey.fromTag(getTag().getCompound(KEY)) : null;
this.unitCount = retrieveUnitCount();
this.highestCompressed = storedItem;

this.compressionEnabled = cell.getUpgrades(i).isInstalled(COMPRESSION_CARD);
}
Expand Down Expand Up @@ -109,6 +111,10 @@ public long getStoredQuantity() {
return clampedLong(unitCount.divide(BigInteger.valueOf(unitFactor)), Long.MAX_VALUE);
}

public AEItemKey getHighestCompressed() {
return highestCompressed;
}

public AEItemKey getFilterItem() {
return filterItem;
}
Expand Down Expand Up @@ -270,6 +276,7 @@ public void getAvailableStacks(KeyCounter out) {
count = count.divide(compressionFactor);
} else {
out.add(variant, clampedLong(count, stackLimit));
highestCompressed = variant;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ private Object2IntMap<AEItemKey> getChain(BulkCellInventory cell) {
Collections.reverse(keys);

var decompressed = new Object2IntLinkedOpenHashMap<AEItemKey>();
keys.forEach(k -> decompressed.put(k, c.getInt(k)));

for (var key : keys.subList(keys.indexOf(cell.getHighestCompressed()), keys.size())) {
decompressed.put(key, c.getInt(key));
}

return decompressed;
}).orElseGet(Object2IntLinkedOpenHashMap::new);
}
Expand Down

0 comments on commit 3121be7

Please sign in to comment.