Skip to content

Commit

Permalink
Remove pre-2.0.0 bulk cell conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 23, 2023
1 parent bec7a22 commit b061409
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,14 @@ public BulkCellInventory(MEGABulkCell cell, ItemStack o, ISaveProvider container
this.unitFactor = decompressed.values().intStream().asLongStream().reduce(1, Math::multiplyExact);

this.storedItem = getTag().contains(KEY) ? AEItemKey.fromTag(getTag().getCompound(KEY)) : null;
this.unitCount = retrieveUnitCount();
this.unitCount = !getTag().getString(UNIT_COUNT).equals("")
? new BigInteger(getTag().getString(UNIT_COUNT))
: BigInteger.ZERO;
this.highestCompressed = storedItem;

this.compressionEnabled = cell.getUpgrades(i).isInstalled(COMPRESSION_CARD);
}

private BigInteger retrieveUnitCount() {
// TODO 1.19.3 / 1.20.0: Remove pre-2.0.0 bulk cell conversion (again)
if (getTag().contains("count")) {
return BigInteger.valueOf(getTag().getLong("count")).multiply(BigInteger.valueOf(unitFactor));
} else {
return !getTag().getString(UNIT_COUNT).equals("")
? new BigInteger(getTag().getString(UNIT_COUNT))
: BigInteger.ZERO;
}
}

private long clampedLong(BigInteger toClamp, long limit) {
return toClamp.min(BigInteger.valueOf(limit)).longValue();
}
Expand Down Expand Up @@ -238,9 +229,6 @@ public void persist() {
getTag().putString(UNIT_COUNT, unitCount.toString());
}

// remove pre-2.0.0 count tag
getTag().remove("count");

isPersisted = true;
}

Expand Down

0 comments on commit b061409

Please sign in to comment.