Skip to content

Commit

Permalink
Fix last available variant still not showing more than 8
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jan 16, 2023
1 parent 8549fb3 commit 20bc300
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,15 @@ public void getAvailableStacks(KeyCounter out) {
var count = unitCount;

for (var variant : allVariants.keySet()) {
if (count.signum() != 1) {
var compressionFactor = BigInteger.valueOf(allVariants.getInt(variant));

if (count.divide(compressionFactor).signum() == 1 && variant != allVariants.lastKey()) {
out.add(variant, clampedLong(count.remainder(compressionFactor), stackLimit));
count = count.divide(compressionFactor);
} else {
out.add(variant, clampedLong(count, stackLimit));
break;
}

var compressionFactor = BigInteger.valueOf(allVariants.getInt(variant));
out.add(variant, clampedLong(count.remainder(compressionFactor), stackLimit));
count = count.divide(compressionFactor);
}
} else {
out.add(storedItem, clampedLong(unitCount.divide(BigInteger.valueOf(unitFactor)), stackLimit));
Expand Down

0 comments on commit 20bc300

Please sign in to comment.