Module @minecraft/server-ui@1.2.0-beta

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"
}

Dependencies

  • @minecraft/common@1.0.0

{
"module_name": "@minecraft/common",
"version": "1.0.0"
}
  • @minecraft/server@1.8.0

{
"module_name": "@minecraft/server",
"version": "1.8.0"
}

Installation

Install type definition for @minecraft/server-ui module using npm:

npm i @minecraft/server-ui@1.2.0-beta.1.21.0-stable

Index

Enumerations

Classes