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,
        arg1: CustomComponentParameters,
    ) => void;
    onBreak?: (
        arg0: BlockComponentBlockBreakEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onEntity?: (
        arg0: BlockComponentEntityEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onEntityFallOn?: (
        arg0: BlockComponentEntityFallOnEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onPlace?: (
        arg0: BlockComponentOnPlaceEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onPlayerBreak?: (
        arg0: BlockComponentPlayerBreakEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onPlayerInteract?: (
        arg0: BlockComponentPlayerInteractEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onRandomTick?: (
        arg0: BlockComponentRandomTickEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onRedstoneUpdate?: (
        arg0: BlockComponentRedstoneUpdateEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onStepOff?: (
        arg0: BlockComponentStepOffEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onStepOn?: (
        arg0: BlockComponentStepOnEvent,
        arg1: CustomComponentParameters,
    ) => void;
    onTick?: (
        arg0: BlockComponentTickEvent,
        arg1: CustomComponentParameters,
    ) => void;
}

Properties

beforeOnPlayerPlace?: (
    arg0: BlockComponentPlayerPlaceBeforeEvent,
    arg1: CustomComponentParameters,
) => void

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

onBreak?: (
    arg0: BlockComponentBlockBreakEvent,
    arg1: CustomComponentParameters,
) => void

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?: (
    arg0: BlockComponentEntityEvent,
    arg1: CustomComponentParameters,
) => void

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

onEntityFallOn?: (
    arg0: BlockComponentEntityFallOnEvent,
    arg1: CustomComponentParameters,
) => void

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

onPlace?: (
    arg0: BlockComponentOnPlaceEvent,
    arg1: CustomComponentParameters,
) => void

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

onPlayerBreak?: (
    arg0: BlockComponentPlayerBreakEvent,
    arg1: CustomComponentParameters,
) => void
onPlayerInteract?: (
    arg0: BlockComponentPlayerInteractEvent,
    arg1: CustomComponentParameters,
) => void

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

onRandomTick?: (
    arg0: BlockComponentRandomTickEvent,
    arg1: CustomComponentParameters,
) => void

This function will be called when a block randomly ticks.

onRedstoneUpdate?: (
    arg0: BlockComponentRedstoneUpdateEvent,
    arg1: CustomComponentParameters,
) => void

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?: (
    arg0: BlockComponentStepOffEvent,
    arg1: CustomComponentParameters,
) => void

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

onStepOn?: (
    arg0: BlockComponentStepOnEvent,
    arg1: CustomComponentParameters,
) => void

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

onTick?: (
    arg0: BlockComponentTickEvent,
    arg1: CustomComponentParameters,
) => void

This function will be called when a block ticks.