How item stacking works
Items stack up to their type’s max_stack value. Default max_stack is 1 (unstackable). When a stack is full, a new stack is created (if capacity allows).
Exceed max_stack creates a new stack
When a stack reaches its maximum size, adding more of the same item automatically creates a new stack. If you have a container “bag” with unlimited capacity and already hold 20 “potion” items, adding 1 more brings the total quantity to 21 but splits the items across 2 separate stacks — the original full stack and a new one for the overflow.
Stack items up to limit
When you add items of the same type to a container in multiple operations, they accumulate into a single quantity. For example, adding 15 “potion” to a bag with unlimited capacity and then adding another 5 results in a total quantity of 20 potions in the bag.
Unstackable items create separate stacks
Since items have a default max_stack of 1, each item occupies its own slot. When you add two swords to a bag with unlimited capacity, both are stored successfully — the total quantity of swords is 2 — but they occupy 2 separate item slots rather than combining into a single stack.
Generated from core/tests/features/stacking.feature