Skip to content

Commit

Permalink
fix: 🐛 Introduced bug in Compression Upgrade controlled part of inven…
Browse files Browse the repository at this point in the history
…tory and its implementation of extractItem method of IItemHandler by not capping the extracted stack at maxStackSize as defined in the API definition. This is a roundabout way of fixing a dupe bug in Refined Storage they are not fixing. Hopefully this doesn't break something else, but other mods are not following this part of API definition and there don't seem to be reports regarding that so fingers crossed.
  • Loading branch information
P3pp3rF1y committed Jan 14, 2025
1 parent e6dad77 commit 8237760
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.daemon=false

mod_id=sophisticatedstorage
mod_group_id=sophisticatedstorage
mod_version=1.1.4
mod_version=1.1.5
sonar_project_key=sophisticatedstorage:SophisticatedStorage
github_package_url=https://maven.pkg.github.com/P3pp3rF1y/SophisticatedStorage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ private int getStackLimit(SlotDefinition slotDefinition) {

@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return extractItem(slot, amount, simulate, ItemStack::getMaxStackSize);
//return extractItem(slot, amount, simulate, ItemStack::getMaxStackSize);
return extractItem(slot, amount, simulate, s -> Integer.MAX_VALUE); //!!! DON'T MERGE THIS TO ANY OTHER VERSION This limitation to max int is a bug introduced so that RS doesn't duplicate !!!
}

private ItemStack extractItem(int slot, int amount, boolean simulate, ToIntFunction<ItemStack> getLimit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ private static List<ExtractingFromFullyFilledSlotsProperlyCalculatesCountsParams
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 256)),
256,
ImmutablePair.of(1, 256),
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2496))
/*Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2496)) !!! THIS GOT BROKEN AS PART OF RS DUPE "FIX" */
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2304))
),
new ExtractingFromFullyFilledSlotsProperlyCalculatesCountsParams(
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 256)),
Expand All @@ -863,7 +864,8 @@ private static List<ExtractingFromFullyFilledSlotsProperlyCalculatesCountsParams
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 256), 2, new ItemStack(Items.IRON_NUGGET, 256)),
256,
ImmutablePair.of(2, 256 + 10 * 9),
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2560), 2, new ItemStack(Items.IRON_NUGGET, 23232)) // the extract gets maxed to 64
/*Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2560), 2, new ItemStack(Items.IRON_NUGGET, 23232)) !!! THIS GOT BROKEN AS PART OF RS DUPE "FIX" // the extract gets maxed to 64*/
Map.of(0, new ItemStack(Items.IRON_BLOCK, 256), 1, new ItemStack(Items.IRON_INGOT, 2550), 2, new ItemStack(Items.IRON_NUGGET, 22950)) // the extract gets maxed to 64
)
);
}
Expand Down

0 comments on commit 8237760

Please sign in to comment.