Skip to content

@minecraft/server


@minecraft/server / BlockPistonComponent

Class: BlockPistonComponent ​

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

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

Extends ​

Properties ​

block ​

readonly block: Block

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

Remarks ​

Block instance that this component pertains to.

Inherited from ​

BlockComponent.block


isMoving ​

readonly isMoving: boolean

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

Remarks ​

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

Throws ​

This property can throw when used.


isValid ​

readonly isValid: boolean

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

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.

Inherited from ​

BlockComponent.isValid


state ​

readonly state: BlockPistonState

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

Remarks ​

The current state of the piston.

Throws ​

This property can throw when used.


typeId ​

readonly typeId: string

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

Remarks ​

Identifier of the component.

Inherited from ​

BlockComponent.typeId


componentId ​

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

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

Methods ​

getAttachedBlocks() ​

getAttachedBlocks(): Block[]

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

Returns ​

Block[]

Remarks ​

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

Throws ​

This function can throw errors.


getAttachedBlocksLocations() ​

getAttachedBlocksLocations(): Vector3[]

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

Returns ​

Vector3[]

Remarks ​

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

Throws ​

This function can throw errors.