The item stack that this trait will be attached to.
Optional
_options: JSONLikeObjectReadonly
identifierThe identifier of the trait.
Protected
Readonly
itemThe item stack that this trait is attached to.
Static
Readonly
componentThe item component that this trait is compatible with by default. If null, the trait will not attach to any item stack by default.
Static
Readonly
identifierThe identifier of the trait.
Static
Readonly
tagThe item tag that this trait is compatible with by default. If null, the trait will not attach to any item stack by default.
Static
Readonly
typesThe item type identifiers that this trait is compatible with by default.
Adds an enchantment to the item stack.
The enchantment id.
The enchantment level.
Clones the item trait to another item stack.
The item stack to clone the component to.
A new item trait.
Compares another item trait to this one.
The other item trait to compare.
Whether the item traits are equal.
Gets an enchantment level from the item stack.
The enchantment id.
The enchantment level if it exists; otherwise, null.
Gets the enchantments on the item stack.
The map of enchantments.
Gets the enchantment list tag from the item stack's NBT.
The enchantment list tag.
Checks if the item stack has an enchantment.
The enchantment id.
Whether the item stack has the enchantment.
Called when the trait is added to an object.
Optional
onCalled when the container that the item is stored in is closed.
The player that closed the container
Optional
onCalled when the container that the item is stored in is opened.
The player that opened the container.
Optional
onCalled when the item is dropped by a player or entity.
The options for the item stack that was dropped.
Optional
onCalled when the release action is triggered by a player.
The player that released the item.
Called when the trait is removed from an object.
Optional
onCalled when the item has been signaled to cooldown.
The duration of the cooldown in ticks.
Optional
onCalled when the item is used by a player.
The player that used the item.
The additional options for the item use.
Whether the item use was successful; default is true
Optional
onCalled when the item cooldown has stopped.
Optional
onCalled when the item is stopped being used by a player.
The player that stopped using the item.
The additional options for the item use.
Optional
onCalled when the trait is ticked by the dimension.
The details about the tick event.
Optional
onCalled when the item is used by a player.
The player that used the item.
The additional options for the item use.
Optional
onCalled when the item is used on a block by a player.
The player that used the item.
The additional options for the item use.
Optional
onCalled when the item is used on an entity by a player.
The player that used the item.
The additional options for the item use.
Removes an enchantment from the item stack.
The enchantment id.
Sets an enchantment on the item stack.
The enchantment id.
The enchantment level.
Creates a new instance of the item trait.