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

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

Properties

Constructors

Properties

block: Block

Remarks

Block impacted by this event.

dimension: Dimension

Remarks

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

isPowered: boolean

Remarks

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

player: Player

Remarks

Optional player that triggered the lever activation.