Contains information related to changes to a button push.

import { world, ButtonPushAfterEvent, system } from '@minecraft/server';

world.afterEvents.buttonPush.subscribe((buttonPushEvent: ButtonPushAfterEvent) => {
const eventLoc = buttonPushEvent.block.location;

world.sendMessage(
`Button push event at tick ${system.currentTick} Power:${buttonPushEvent.block.getRedstonePower()}`,
);
});

Hierarchy (View Summary)

Properties

block: Block

Block impacted by this event.

dimension: Dimension

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

source: Entity

Optional source that triggered the button push.