Beta
Manages callbacks that are connected to when a button is pushed.
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()}`, );}); Copy
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()}`, );});
Subscribes to the event.
This function can't be called in read-only mode.
Unsubscribes from the event.
Manages callbacks that are connected to when a button is pushed.
Example: buttonPushEvent.ts