Skip to main content

Module item_stack

Module item_stack 

Expand description

Owned item values and typed component patches. Owned item values. Registry-dependent validation belongs to the game’s write boundary.

Structs§

Components
An owned component patch, independent of the engine’s component representation.
ItemStack
A nonempty, owned item value. Maxima are checked when the game accepts a write, not by this record: item definitions and effective component overrides belong to the game. The component patch is shared copy-on-write: Clone counts a reference instead of copying it, the first write through a shared stack copies the patch once, and equality of two stacks that still share it is a pointer comparison. An absent patch allocates nothing.
StackSplit
The two nonempty portions of a consuming split. Either portion can be absent.

Enums§

StackError
A stack operation could not represent the requested count.
StackWriteError
Why the game refused to accept an owned stack at a write boundary.

Traits§

Component
A typed descriptor for one component in an item’s component patch. Implementations own the conversion between their value and Minecraft NBT.