@minecraft/server-uiBeta

The @minecraft/server-ui module contains types for expressing simple dialog-based user experiences.

  • ActionFormData contain a list of buttons with captions and images that can be used for presenting a set of options to a player.
  • MessageFormData are simple two-button message experiences that are functional for Yes/No or OK/Cancel questions.
  • ModalFormData allow for a more flexible "questionnaire-style" list of controls that can be used to take input.

Example

createActionForm.js

const form = new ActionFormData()
.title("Months")
.body("Choose your favorite month!")
.button("January")
.button("February")
.button("March")
.button("April")
.button("May");

form.show(players[0]).then((response) => {
if (response.selection === 3) {
dimension.runCommand("say I like April too!");
}
});

Manifest Details

{
"module_name": "@minecraft/server-ui",
"version": "1.1.0-internal.1.20.0-preview.23"
}

Index

Enumerations

Classes