Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How item identity works

Each item type in a container has a unique instance identity. Adding the same item type again stacks (increases quantity).

Adding the same item type stacks quantity

When you add the same item type to a container more than once, the system stacks them into a single entry rather than creating duplicates. For example, adding 1 “iron_sword” to an unlimited-capacity inventory and then adding another 1 “iron_sword” results in just 1 item in the container with a quantity of 2.

Different item types are separate instances

When you add different item types to the same container, each one becomes a separate instance with its own unique identity. For example, adding 1 “iron_sword” and 1 “steel_sword” to an unlimited-capacity inventory results in 2 distinct items, each with a different identity. This ensures that different item types are never merged together, even though they live in the same container.

Removed item can be identified by its instance

When you remove a specific item instance from a container, the operation succeeds and the removed item still carries a reference back to its original definition. For example, if you add 1 “iron_sword” to an unlimited-capacity “inventory” and then remove that specific instance, you can inspect the returned item and confirm it references the “iron_sword” definition. This lets you track and identify items even after they leave a container.


Generated from core/tests/features/item_identity.feature