Interface: BlockCustomComponent
block componentBeta
包含将为方块触发的一组事件。
此对象必须使用 BlockRegistry 进行绑定。
Contains a set of events that will be raised for a block. This object must be bound using the BlockRegistry.
Properties
beforeOnPlayerPlace?
optionalbeforeOnPlayerPlace?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentPlayerPlaceBeforeEvent
arg1
Returns
void
Remarks
该函数将在玩家放置方块之前被调用。
This function will be called before a player places the block.
onBlockStateChange?
optionalonBlockStateChange?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentBlockStateChangeEvent
arg1
Returns
void
onBreak?
optionalonBreak?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
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?
optionalonEntity?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在世界中的实体向此方块触发事件时被调用。
This function will be called when an entity fires an event to this block in the world.
onEntityFallOn?
optionalonEntityFallOn?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentEntityFallOnEvent
arg1
Returns
void
Remarks
该函数将在实体落到此自定义组件所绑定的方块上时被调用。
This function will be called when an entity falls onto the block that this custom component is bound to.
onPlace?
optionalonPlace?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在此自定义组件所绑定的方块被放置时被调用。
This function will be called when the block that this custom component is bound to is placed.
onPlayerBreak?
optionalonPlayerBreak?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentPlayerBreakEvent
arg1
Returns
void
onPlayerInteract?
optionalonPlayerInteract?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentPlayerInteractEvent
arg1
Returns
void
Remarks
该函数将在玩家成功与此自定义组件所绑定的方块交互时被调用。
This function will be called when a player sucessfully interacts with the block that this custom component is bound to.
onRandomTick?
optionalonRandomTick?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在方块随机 tick 时被调用。
This function will be called when a block randomly ticks.
onRedstoneUpdate?
optionalonRedstoneUpdate?: (arg0,arg1) =>void
Beta
Parameters
arg0
BlockComponentRedstoneUpdateEvent
arg1
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?
optionalonStepOff?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在实体离开此自定义组件所绑定的方块时被调用。
This function will be called when an entity steps off the block that this custom component is bound to.
onStepOn?
optionalonStepOn?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在实体踏上此自定义组件所绑定的方块时被调用。
This function will be called when an entity steps onto the block that this custom component is bound to.
onTick?
optionalonTick?: (arg0,arg1) =>void
Beta
Parameters
arg0
arg1
Returns
void
Remarks
该函数将在方块 tick 时被调用。
This function will be called when a block ticks.
