The block to create the trait for.
Optional
options: Partial<BlockInventoryTraitOptions>The options for the block inventory trait.
Protected
Readonly
blockThe block that this trait is attached to.
Readonly
componentsThe block component identifiers that this trait is compatible with. If empty, the trait will not be initialized by any component.
Protected
Readonly
dimensionThe dimension that the block is in.
Readonly
identifierThe identifier of the trait.
Protected
openedWhether the block is opened or not.
Readonly
stateThe block state key that this trait is compatible with. If null, the trait will not be initialized by any block state.
Static
Readonly
componentsThe block component identifiers that this trait is compatible with by default. If empty, the trait will not be initialized by any component.
Static
Readonly
identifierThe identifier of the trait.
Static
Readonly
stateThe block state key that this trait is compatible with by default. If null, the trait will not be initialized by any block state.
Static
Readonly
typesThe block type identifiers that this trait is compatible with by default.
The property used to store the inventory items.
Called when the trait is added to an object.
Called when the block is broken in the world.
Whether the block break was successful; default is true.
Called when the state of the inventory is set to close.
Called when a container that is attached to the block is updated.
The container that was updated.
Called when the block is interacted with by a player.
The options of the block interaction.
Whether the interaction was successful; default is true.
Called when the state of the inventory is set to open.
Optional
onCalled when a player pick blocks the block.
The player that picked the block.
Whether the player picked the block with a data request.
Optional
onCalled when the block is placed in the world.
The options of the block placement.
Whether the block placement was successful; default is true.
Called when the trait is removed from an object.
Optional
onOptional
onCalled when the block is started to be broken in the world.
The player that started to break the block.
Optional
onCalled when the block is stopped to be broken in the world.
The player that stopped breaking the block.
Called when the trait is ticked by the dimension.
Optional
onCalled when the block is updated in the world.
Optional
source: BlockThe source of the update, if any.
Create a new inventory trait for a specific block.