接口 BlockCustomComponent实验性

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

interface BlockCustomComponent {
    beforeOnPlayerPlace?: ((arg: BlockComponentPlayerPlaceBeforeEvent) => void);
    onEntityFallOn?: ((arg: BlockComponentEntityFallOnEvent) => void);
    onPlace?: ((arg: BlockComponentOnPlaceEvent) => void);
    onPlayerDestroy?: ((arg: BlockComponentPlayerDestroyEvent) => void);
    onPlayerInteract?: ((arg: BlockComponentPlayerInteractEvent) => void);
    onRandomTick?: ((arg: BlockComponentRandomTickEvent) => void);
    onStepOff?: ((arg: BlockComponentStepOffEvent) => void);
    onStepOn?: ((arg: BlockComponentStepOnEvent) => void);
    onTick?: ((arg: BlockComponentTickEvent) => void);
}

属性

beforeOnPlayerPlace?: ((arg: BlockComponentPlayerPlaceBeforeEvent) => void)

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

onEntityFallOn?: ((arg: BlockComponentEntityFallOnEvent) => void)

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

onPlace?: ((arg: BlockComponentOnPlaceEvent) => void)

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

onPlayerDestroy?: ((arg: BlockComponentPlayerDestroyEvent) => void)

This function will be called when a player destroys a specific block.

onPlayerInteract?: ((arg: BlockComponentPlayerInteractEvent) => void)

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

onRandomTick?: ((arg: BlockComponentRandomTickEvent) => void)

This function will be called when a block randomly ticks.

onStepOff?: ((arg: BlockComponentStepOffEvent) => void)

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

onStepOn?: ((arg: BlockComponentStepOnEvent) => void)

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

onTick?: ((arg: BlockComponentTickEvent) => void)

This function will be called when a block ticks.