Beta
Returns data about the player results from a modal action form.
import { Player } from '@minecraft/server';import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';function askFavoriteMonth(player: Player) { const form = new ActionFormData() .title('Months') .body('Choose your favorite month!') .button('January') .button('February') .button('March') .button('April') .button('May'); form.show(player).then((response: ActionFormResponse) => { if (response.selection === 3) { player.sendMessage('I like April too!'); } else { player.sendMessage('Nah, April is the best.'); } });} Copy
import { Player } from '@minecraft/server';import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';function askFavoriteMonth(player: Player) { const form = new ActionFormData() .title('Months') .body('Choose your favorite month!') .button('January') .button('February') .button('March') .button('April') .button('May'); form.show(player).then((response: ActionFormResponse) => { if (response.selection === 3) { player.sendMessage('I like April too!'); } else { player.sendMessage('Nah, April is the best.'); } });}
Optional
Readonly
Contains additional details as to why a form was canceled.
If true, the form was canceled by the player (e.g., they selected the pop-up X close button).
Returns the index of the button that was pushed.
Returns data about the player results from a modal action form.
Example: actionFormAskFavoriteMonth.ts