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

    Manages callbacks that are connected to piston activations.

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

    Methods

    • Parameters

      Returns void

      Removes a callback from being called when a piston expands or retracts.

      This function can't be called in read-only mode.