Skip to content

@minecraft/server


@minecraft/server / ItemCustomComponent

Interface: ItemCustomComponent ​

Defined in: @minecraft/server/index.d.ts:24073

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

Defined in: @minecraft/server/index.d.ts:24081

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

Defined in: @minecraft/server/index.d.ts:24091

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

Defined in: @minecraft/server/index.d.ts:24098

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

Defined in: @minecraft/server/index.d.ts:24105

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

Defined in: @minecraft/server/index.d.ts:24112

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

Defined in: @minecraft/server/index.d.ts:24119

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

Defined in: @minecraft/server/index.d.ts:24126

Parameters ​

arg0 ​

ItemComponentUseOnEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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