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
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
Function
Parameters
Parameter | Type |
---|---|
arg | PistonActivateAfterEvent |
Returns
void
Remarks
This function can't be called in read-only mode.
unsubscribe()
unsubscribe(
callback
):void
Parameters
Parameter | Type |
---|---|
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.