For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/interfaces/ItemCustomComponent.md.

Interface: ItemCustomComponent

component

Beta

包含将为物品触发的一组事件。 此对象必须使用 ItemComponentRegistry 进行绑定。

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

Properties

onBeforeDurabilityDamage?

optional onBeforeDurabilityDamage?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentBeforeDurabilityDamageEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品击中实体并即将消耗耐久度时,将调用此函数。

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


onCompleteUse?

optional onCompleteUse?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentCompleteUseEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品的使用时长完成时,将调用此函数。

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


onConsume?

optional onConsume?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentConsumeEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品被实体食用时,将调用此函数。

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


onHitEntity?

optional onHitEntity?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentHitEntityEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品用于击中另一个实体时,将调用此函数。

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


onMineBlock?

optional onMineBlock?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentMineBlockEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品用于挖掘方块时,将调用此函数。

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


onUse?

optional onUse?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentUseEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品被玩家使用时,将调用此函数。

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


onUseOn?

optional onUseOn?: (arg0, arg1) => void

Beta

Parameters

arg0

ItemComponentUseOnEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当包含此组件的物品在方块上被使用时,将调用此函数。

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

同领域相关