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

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

Properties

onBeforeDurabilityDamage?: (
    arg0: ItemComponentBeforeDurabilityDamageEvent,
    arg1: CustomComponentParameters,
) => void

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

onCompleteUse?: (
    arg0: ItemComponentCompleteUseEvent,
    arg1: CustomComponentParameters,
) => void

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

onConsume?: (
    arg0: ItemComponentConsumeEvent,
    arg1: CustomComponentParameters,
) => void

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

onHitEntity?: (
    arg0: ItemComponentHitEntityEvent,
    arg1: CustomComponentParameters,
) => void

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

onMineBlock?: (
    arg0: ItemComponentMineBlockEvent,
    arg1: CustomComponentParameters,
) => void

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

onUse?: (arg0: ItemComponentUseEvent, arg1: CustomComponentParameters) => void

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

onUseOn?: (
    arg0: ItemComponentUseOnEvent,
    arg1: CustomComponentParameters,
) => void

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