Script API - v1.21.0

Script API References

Landing page for Minecraft Bedrock Script API Reference, containing documentation related to experimental and stable Minecraft Script APIs to interact with a Minecraft world programmatically.

The libraries of Script APIs are grouped under the @minecraft scope on Minecraft and npm.

Documentation

Visit one of the following links to view the full documentation that matches your Minecraft version.

Minecraft Module

The main script module for Script API is @minecraft/server. Core library features:

  • Manipulate a Minecraft world, including entities, blocks, dimensions, and more.
  • Events - Execute code when a specific event in a Minecraft occurs.
  • Storage - Storage for entities, items and world that is accessible with only script API.

Minecraft UI Module

The @minecraft/server-ui module helps you build simple form or dialogs to players.

Action Forms - A form with a list of buttons with captions and images for presenting a set of options to a player.

Message Forms - A form with two-button that are functional for Yes/No or OK/Cancel questions.

Modal Forms - A more flexible "questionnaire-style" list of controls in a form that can be used to take input.

GameTest Framework

One of the sample GameTests from Microsoft sample GameTest repository on GitHub

GameTest Framework is a toolset available to creators to build and test any new content using the @minecraft/server-gametest script module and the /gametest command in Minecraft. Each GameTest is broken into the following:

  • Register a test: create an environment to conduct a test.
  • Setup a test: Setup the environment to run the test.
  • Validate a test: Evaluates whether a test passed or failed.

Minecraft HTTP module

Use the Script API to send HTTP requests to the internet using the @minecraft/server-net module.

Minecraft Editor Module

Bedrock Editor in Minecraft Preview v1.21.30 (August 2024)

The Minecraft Editor or the @minecraft/server-editor module is a built-in JavaScript library for building complex tools based on components provided by the Minecraft Editor API, created on top of Ore UI.

The Minecraft Editor module is heavily used on an Editor Extension, a set of resource pack and behavior packs (like .mcaddon files but for editor) loaded into Editor at start up time.

Keep in mind this API can only be used with Minecraft: Bedrock Editor engine loaded, which is only accessible in Bedrock Preview on Windows.

Server Admin Module

Load configuration of variables and secrets in Bedrock Dedicated Server folder using Script API.

Debug Utilities Module

A Script API module that is used for debugging purposes. Currently features:

  • Disable performance watchdog timing warnings.