Class: ButtonPushAfterEventSignal
Manages callbacks that are connected to when a button is pushed.
Example
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()}`,
);
});
Extends
Constructors
new ButtonPushAfterEventSignal()
private
new ButtonPushAfterEventSignal():ButtonPushAfterEventSignal
Returns
Overrides
IButtonPushAfterEventSignal
. constructor
Methods
subscribe()
subscribe(
callback
): (arg
) =>void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
Function
Parameters
Parameter | Type |
---|---|
arg | ButtonPushAfterEvent |
Returns
void
Inherited from
IButtonPushAfterEventSignal
. subscribe
Remarks
Subscribes to the event.
This function can't be called in read-only mode.
unsubscribe()
unsubscribe(
callback
):void
Parameters
Parameter | Type |
---|---|
callback | (arg ) => void |
Returns
void
Inherited from
IButtonPushAfterEventSignal
. unsubscribe
Remarks
Unsubscribes from the event.
This function can't be called in read-only mode.