Skip to main content

Class: PistonActivateAfterEventSignal

Manages callbacks that are connected to piston activations.

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

Constructors

new PistonActivateAfterEventSignal()

private new PistonActivateAfterEventSignal(): PistonActivateAfterEventSignal

Returns

PistonActivateAfterEventSignal

Methods

subscribe()

subscribe(callback): (arg) => void

Parameters

ParameterType
callback(arg) => void

Returns

Function

Parameters
ParameterType
argPistonActivateAfterEvent
Returns

void

Remarks

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


unsubscribe()

unsubscribe(callback): void

Parameters

ParameterType
callback(arg) => void

Returns

void

Remarks

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

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

Throws

This function can throw errors.