Script API - v1.21.0
    Preparing search index...

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

    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}`,
    );
    });

    Hierarchy (View Summary)

    Index

    Properties

    block: Block

    Block impacted by this event.

    dimension: Dimension

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

    isExpanding: boolean

    True if the piston is the process of expanding.

    Contains additional properties and details of the piston.