接口 BlockCustomComponent

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

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

属性

beforeOnPlayerPlace?: (arg0: BlockComponentPlayerPlaceBeforeEvent) => void

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

onEntityFallOn?: (arg0: BlockComponentEntityFallOnEvent) => void

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

onPlace?: (arg0: BlockComponentOnPlaceEvent) => void

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

onPlayerDestroy?: (arg0: BlockComponentPlayerDestroyEvent) => void

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

onPlayerInteract?: (arg0: BlockComponentPlayerInteractEvent) => void

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

onRandomTick?: (arg0: BlockComponentRandomTickEvent) => void

This function will be called when a block randomly ticks.

onStepOff?: (arg0: BlockComponentStepOffEvent) => void

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

onStepOn?: (arg0: BlockComponentStepOnEvent) => void

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

onTick?: (arg0: BlockComponentTickEvent) => void

This function will be called when a block ticks.