Skip to main content

Class: PistonActivateAfterEvent

Contains information related to changes to a piston expanding or retracting.

Example

import { world, system, PistonActivateAfterEvent } from '@minecraft/server';

world.afterEvents.pistonActivate.subscribe((pistonEvent: PistonActivateAfterEvent) => {
console.warn(
`Piston event at ${system.currentTick} ${(pistonEvent.piston.isMoving ? ' Moving' : 'Not moving')} with state: ${pistonEvent.piston.state}`,
);
});

Extends

Constructors

new PistonActivateAfterEvent()

private new PistonActivateAfterEvent(): PistonActivateAfterEvent

Returns

PistonActivateAfterEvent

Overrides

BlockEvent . constructor

Properties

block

readonly block: Block

Remarks

Block impacted by this event.

Inherited from

BlockEvent . block


dimension

readonly dimension: Dimension

Remarks

Dimension that contains the block that is the subject of this event.

Inherited from

BlockEvent . dimension


isExpanding

readonly isExpanding: boolean

Remarks

True if the piston is the process of expanding.


piston

readonly piston: BlockPistonComponent

Remarks

Contains additional properties and details of the piston.