chore: another stack size test

This commit is contained in:
mworzala 2024-04-29 01:17:31 -04:00
parent e4d32b8164
commit 1fc81aa411
No known key found for this signature in database
GPG Key ID: B148F922E64797C7
1 changed files with 13 additions and 0 deletions

View File

@ -93,4 +93,17 @@ public class InventoryTest {
assertTrue(inventory.addItemStack(item, TransactionOption.ALL_OR_NOTHING));
assertEquals(99, inventory.getItemStack(0).amount());
}
@Test
public void testStackSize99OnSmaller() {
var inventory = new ContainerInventory(InventoryType.CHEST_1_ROW, "title");
var item44 = ItemStack.builder(Material.DIAMOND).set(ItemComponent.MAX_STACK_SIZE, 44).amount(43).build();
var item99 = ItemStack.builder(Material.DIAMOND).set(ItemComponent.MAX_STACK_SIZE, 99).amount(99).build();
// Note this is vanilla behavior not to stack these two because they have different components.
assertTrue(inventory.addItemStack(item44, TransactionOption.ALL_OR_NOTHING));
assertTrue(inventory.addItemStack(item99, TransactionOption.ALL_OR_NOTHING));
assertEquals(43, inventory.getItemStack(0).amount());
assertEquals(99, inventory.getItemStack(1).amount());
}
}