接口 ItemCustomComponent实验性

Contains a set of events that will be raised for an item. This object must be bound using the ItemComponentRegistry.

interface ItemCustomComponent {
    onBeforeDurabilityDamage?: ((arg: ItemComponentBeforeDurabilityDamageEvent) => void);
    onCompleteUse?: ((arg: ItemComponentCompleteUseEvent) => void);
    onConsume?: ((arg: ItemComponentConsumeEvent) => void);
    onHitEntity?: ((arg: ItemComponentHitEntityEvent) => void);
    onMineBlock?: ((arg: ItemComponentMineBlockEvent) => void);
    onUse?: ((arg: ItemComponentUseEvent) => void);
    onUseOn?: ((arg: ItemComponentUseOnEvent) => void);
}

属性

onBeforeDurabilityDamage?: ((arg: ItemComponentBeforeDurabilityDamageEvent) => void)

This function will be called when an item containing this component is hitting an entity and about to take durability damage.

onCompleteUse?: ((arg: ItemComponentCompleteUseEvent) => void)

This function will be called when an item containing this component's use duration was completed.

onConsume?: ((arg: ItemComponentConsumeEvent) => void)

This function will be called when an item containing this component is eaten by an entity.

onHitEntity?: ((arg: ItemComponentHitEntityEvent) => void)

This function will be called when an item containing this component is used to hit another entity.

onMineBlock?: ((arg: ItemComponentMineBlockEvent) => void)

This function will be called when an item containing this component is used to mine a block.

onUse?: ((arg: ItemComponentUseEvent) => void)

This function will be called when an item containing this component is used by a player.

onUseOn?: ((arg: ItemComponentUseOnEvent) => void)

This function will be called when an item containing this component is used on a block.