Manages callbacks that are connected to lever moves (activates or deactivates).

Example

leverActionEvent.ts

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

Hierarchy

Constructors

Methods

Constructors

Methods

  • Parameters

    Returns ((arg) => void)

      • (arg): void
      • Parameters

        Returns void

        Remarks

        Subscribes to the event.

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

    Remarks

    Subscribes to the event.

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