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

Methods

  • Beta

    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.

    This function can be called in early-execution mode.