Class: LeverActionAfterEventSignal
Manages callbacks that are connected to lever moves (activates or deactivates).
Example
import { world, system, LeverActionAfterEvent } from '@minecraft/server';
world.afterEvents.leverAction.subscribe((leverActivateEvent: LeverActionAfterEvent) => {
console.warn(
`Lever event at ${system.currentTick} with power: ${leverActivateEvent.block.getRedstonePower()}`,
);
});
Extends
Constructors
new LeverActionAfterEventSignal()
private
new LeverActionAfterEventSignal():LeverActionAfterEventSignal
Returns
Overrides
ILeverActionAfterEventSignal
. constructor
Methods
subscribe()
subscribe(
callback
): (arg
) =>void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
Function
Parameters
Parameter | Type |
---|---|
arg | LeverActionAfterEvent |
Returns
void
Inherited from
ILeverActionAfterEventSignal
. subscribe
Remarks
Subscribes to the event.
This function can't be called in read-only mode.
unsubscribe()
unsubscribe(
callback
):void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
void
Inherited from
ILeverActionAfterEventSignal
. unsubscribe
Remarks
Unsubscribes from the event.
This function can't be called in read-only mode.
Throws
This function can throw errors.