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/BlockCustomComponent.md.

Interface: BlockCustomComponent

block component

Beta

包含将为方块触发的一组事件。 此对象必须使用 BlockRegistry 进行绑定。

Contains a set of events that will be raised for a block. This object must be bound using the BlockRegistry.

Properties

beforeOnPlayerPlace?

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

Beta

Parameters

arg0

BlockComponentPlayerPlaceBeforeEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在玩家放置方块之前被调用。

This function will be called before a player places the block.


onBlockStateChange?

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

Beta

Parameters

arg0

BlockComponentBlockStateChangeEvent

arg1

CustomComponentParameters

Returns

void


onBreak?

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

Beta

Parameters

arg0

BlockComponentBlockBreakEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在特定方块被破坏时被调用。 方块置换的变化不会触发此事件。 仅当使用破坏模式更改方块置换时,Fill 命令和 SetBlock 命令才会触发此事件。 具有 minecraft:replaceable 组件的自定义方块在被替换时不会触发此事件。

This function will be called when a specific block is destroyed. Changes in block permutations will not trigger this event. Fill Command and SetBlock Command can trigger this event when changing a block permutation only when using destroy mode. Custom blocks with the "minecraft:replaceable" component will not trigger the event when replaced.


onEntity?

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

Beta

Parameters

arg0

BlockComponentEntityEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在世界中的实体向此方块触发事件时被调用。

This function will be called when an entity fires an event to this block in the world.


onEntityFallOn?

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

Beta

Parameters

arg0

BlockComponentEntityFallOnEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在实体落到此自定义组件所绑定的方块上时被调用。

This function will be called when an entity falls onto the block that this custom component is bound to.


onPlace?

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

Beta

Parameters

arg0

BlockComponentOnPlaceEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在此自定义组件所绑定的方块被放置时被调用。

This function will be called when the block that this custom component is bound to is placed.


onPlayerBreak?

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

Beta

Parameters

arg0

BlockComponentPlayerBreakEvent

arg1

CustomComponentParameters

Returns

void


onPlayerInteract?

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

Beta

Parameters

arg0

BlockComponentPlayerInteractEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在玩家成功与此自定义组件所绑定的方块交互时被调用。

This function will be called when a player sucessfully interacts with the block that this custom component is bound to.


onRandomTick?

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

Beta

Parameters

arg0

BlockComponentRandomTickEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在方块随机 tick 时被调用。

This function will be called when a block randomly ticks.


onRedstoneUpdate?

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

Beta

Parameters

arg0

BlockComponentRedstoneUpdateEvent

arg1

CustomComponentParameters

Returns

void

Remarks

当发生 onRedstoneUpdate 引擎事件时,如果方块具有 minecraft:redstone_consumer 组件且红石信号强度 >= 该组件的 min_power 字段,则将调用此函数。

This function will be called when an 'onRedstoneUpdate' engine event occurs if the block has a minecraft:redstone_consumer component and the redstone signal strength is >= to the components min_power field.


onStepOff?

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

Beta

Parameters

arg0

BlockComponentStepOffEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在实体离开此自定义组件所绑定的方块时被调用。

This function will be called when an entity steps off the block that this custom component is bound to.


onStepOn?

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

Beta

Parameters

arg0

BlockComponentStepOnEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在实体踏上此自定义组件所绑定的方块时被调用。

This function will be called when an entity steps onto the block that this custom component is bound to.


onTick?

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

Beta

Parameters

arg0

BlockComponentTickEvent

arg1

CustomComponentParameters

Returns

void

Remarks

该函数将在方块 tick 时被调用。

This function will be called when a block ticks.

同领域相关