1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-31 05:33:00 +00:00

Correctly obey stack limits in OffsetStorage.extract/insert

Many thanks to Lem for managing to reproduce it. It was actually an easy
bug bug to spot on second look, but having a reliable way to verify was
super helpful.

Fixes #1338
This commit is contained in:
Jonathan Coates
2023-03-15 20:07:17 +00:00
parent e96ac35d67
commit 44f945c040
5 changed files with 48 additions and 13 deletions

View File

@@ -22,7 +22,7 @@ public class InventoryUtilTest {
var remainder = InventoryUtil.storeItemsFromOffset(container, new ItemStack(Items.COBBLESTONE, 32), 4);
assertThat("Remainder is empty", remainder, isStack(ItemStack.EMPTY));
assertThat("Was inserted into slot", container.getItem(4), isStack(new ItemStack(Items.COBBLESTONE, 32)));
assertThat("Was inserted into slot", container.getItem(4), isStack(Items.COBBLESTONE, 32));
}
@Test
@@ -33,6 +33,6 @@ public class InventoryUtilTest {
var remainder = InventoryUtil.storeItemsFromOffset(container, new ItemStack(Items.COBBLESTONE, 32), 4);
assertThat("Remainder is empty", remainder, isStack(ItemStack.EMPTY));
assertThat("Was inserted into slot", container.getItem(1), isStack(new ItemStack(Items.COBBLESTONE, 32)));
assertThat("Was inserted into slot", container.getItem(1), isStack(Items.COBBLESTONE, 32));
}
}