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}`, );}); Copy
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}`, );});
This function can't be called in read-only mode.
This function can be called in early-execution mode.
Removes a callback from being called when a piston expands or retracts.
Manages callbacks that are connected to piston activations.
Example: pistonAfterEvent.ts