Skip to content

@minecraft/server


@minecraft/server / BlockCustomComponent

Interface: BlockCustomComponent ​

Defined in: @minecraft/server/index.d.ts:22447

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

Properties ​

beforeOnPlayerPlace? ​

optional beforeOnPlayerPlace?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22454

Parameters ​

arg0 ​

BlockComponentPlayerPlaceBeforeEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onBlockStateChange? ​

optional onBlockStateChange?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22455

Parameters ​

arg0 ​

BlockComponentBlockStateChangeEvent

arg1 ​

CustomComponentParameters

Returns ​

void


onBreak? ​

optional onBreak?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22468

Parameters ​

arg0 ​

BlockComponentBlockBreakEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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? ​

optional onEntity?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22475

Parameters ​

arg0 ​

BlockComponentEntityEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onEntityFallOn? ​

optional onEntityFallOn?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22482

Parameters ​

arg0 ​

BlockComponentEntityFallOnEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onPlace? ​

optional onPlace?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22489

Parameters ​

arg0 ​

BlockComponentOnPlaceEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onPlayerBreak? ​

optional onPlayerBreak?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22490

Parameters ​

arg0 ​

BlockComponentPlayerBreakEvent

arg1 ​

CustomComponentParameters

Returns ​

void


onPlayerInteract? ​

optional onPlayerInteract?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22498

Parameters ​

arg0 ​

BlockComponentPlayerInteractEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onRandomTick? ​

optional onRandomTick?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22504

Parameters ​

arg0 ​

BlockComponentRandomTickEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

This function will be called when a block randomly ticks.


onRedstoneUpdate? ​

optional onRedstoneUpdate?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22513

Parameters ​

arg0 ​

BlockComponentRedstoneUpdateEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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? ​

optional onStepOff?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22520

Parameters ​

arg0 ​

BlockComponentStepOffEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onStepOn? ​

optional onStepOn?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22527

Parameters ​

arg0 ​

BlockComponentStepOnEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

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


onTick? ​

optional onTick?: (arg0, arg1) => void

Defined in: @minecraft/server/index.d.ts:22533

Parameters ​

arg0 ​

BlockComponentTickEvent

arg1 ​

CustomComponentParameters

Returns ​

void

Remarks ​

This function will be called when a block ticks.