Skip to main content

Class: BlockPistonComponent

When present, this block has piston-like behavior. Contains additional properties for discovering block piston state.

Extends

Constructors

new BlockPistonComponent()

private new BlockPistonComponent(): BlockPistonComponent

Returns

BlockPistonComponent

Overrides

BlockComponent . constructor

Properties

block

readonly block: Block

Remarks

Block instance that this component pertains to.

Inherited from

BlockComponent . block


isMoving

readonly isMoving: boolean

Remarks

Whether the piston is in the process of expanding or retracting.

Throws

This property can throw when used.


state

readonly state: BlockPistonState

Remarks

The current state of the piston.

Throws

This property can throw when used.


typeId

readonly typeId: string

Remarks

Identifier of the component.

Inherited from

BlockComponent . typeId


componentId

static readonly componentId: "minecraft:piston" = 'minecraft:piston'

Methods

getAttachedBlocks()

getAttachedBlocks(): Block[]

Returns

Block[]

Remarks

Retrieves a set of blocks that this piston is connected with.

Throws

This function can throw errors.


getAttachedBlocksLocations()

getAttachedBlocksLocations(): Vector3[]

Returns

Vector3[]

Remarks

Retrieves a set of block locations that this piston is connected with.

Throws

This function can throw errors.


isValid()

isValid(): boolean

Returns

boolean

Whether the component is valid.

Inherited from

BlockComponent . isValid

Remarks

Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.