Editar

Compartir vía


BlockCustomComponent Interface

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

Properties

beforeOnPlayerPlace

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

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

Type: (arg0: BlockComponentPlayerPlaceBeforeEvent, arg1: CustomComponentParameters) => void

onBlockStateChange

onBlockStateChange?: (arg0: BlockComponentBlockStateChangeEvent, arg1: CustomComponentParameters) => void;

Type: (arg0: BlockComponentBlockStateChangeEvent, arg1: CustomComponentParameters) => void

Caution

This property is still in pre-release. Its signature may change or it may be removed in future releases.

onBreak

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.

Type: (arg0: BlockComponentBlockBreakEvent, arg1: CustomComponentParameters) => void

onEntity

onEntity?: (arg0: BlockComponentEntityEvent, arg1: CustomComponentParameters) => void;

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

Type: (arg0: BlockComponentEntityEvent, arg1: CustomComponentParameters) => void

onEntityFallOn

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.

Type: (arg0: BlockComponentEntityFallOnEvent, arg1: CustomComponentParameters) => void

onPlace

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

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

Type: (arg0: BlockComponentOnPlaceEvent, arg1: CustomComponentParameters) => void

onPlayerBreak

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

Type: (arg0: BlockComponentPlayerBreakEvent, arg1: CustomComponentParameters) => void

onPlayerInteract

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.

Type: (arg0: BlockComponentPlayerInteractEvent, arg1: CustomComponentParameters) => void

onRandomTick

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

This function will be called when a block randomly ticks.

Type: (arg0: BlockComponentRandomTickEvent, arg1: CustomComponentParameters) => void

onRedstoneUpdate

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.

Type: (arg0: BlockComponentRedstoneUpdateEvent, arg1: CustomComponentParameters) => void

onStepOff

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.

Type: (arg0: BlockComponentStepOffEvent, arg1: CustomComponentParameters) => void

onStepOn

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.

Type: (arg0: BlockComponentStepOnEvent, arg1: CustomComponentParameters) => void

onTick

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

This function will be called when a block ticks.

Type: (arg0: BlockComponentTickEvent, arg1: CustomComponentParameters) => void