Base class for custom item components.
Use with the ItemComponent decorator for automatic registration.
@ItemComponentclass MyItem extends CustomItem { static readonly COMPONENT_ID = `${Data.NAMESPACE}:my_item`; onUse(event: ItemComponentUseEvent) { // handle use }} Copy
@ItemComponentclass MyItem extends CustomItem { static readonly COMPONENT_ID = `${Data.NAMESPACE}:my_item`; onUse(event: ItemComponentUseEvent) { // handle use }}
Static
Readonly
Optional
This function will be called when an item containing this component is hitting an entity and about to take durability damage.
This function will be called when an item containing this component's use duration was completed.
This function will be called when an item containing this component is eaten by an entity.
This function will be called when an item containing this component is used to hit another entity.
This function will be called when an item containing this component is used to mine a block.
This function will be called when an item containing this component is used by a player.
This function will be called when an item containing this component is used on a block.
Base class for custom item components.
Use with the ItemComponent decorator for automatic registration.
Example