Script API - v1.21.0
    Preparing search index...

    Contains information related to changes to a lever activating or deactivating.

    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 (View Summary)

    Index

    Properties

    block: Block

    Block impacted by this event.

    dimension: Dimension

    Dimension that contains the block that is the subject of this event.

    isPowered: boolean

    True if the lever is activated (that is, transmitting power).

    player: Player

    Optional player that triggered the lever activation.