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.
Visit one of the following links to view the full documentation that matches your Minecraft version.
Minecraft: Bedrock Edition API references: Script API - Latest
Minecraft: Bedrock Edition Preview API references: Script API - Preview
The Minecraft module, also known as @minecraft/server
module, is the main script module to manipulate a Minecraft world. Here are some programmatic features that are available in the Minecraft module:
Here are some core features the module provides:
The Minecraft module allows you to respond to specific event occurs in Minecraft using event handlers in JavaScript. Event handlers are callback routines made by you. They are triggered in response to an interaction, like when a player interacts with an entity.
Minecraft Script API's events are broken down into following categories:
The Minecraft module also provides mechanisms for script plugins to store data, in key/value pairs, in a Minecraft world.
The two mechanisms within Minecraft world storage (accessible through Script API) are as follows:
The @minecraft/server-ui
module helps you build simple form or dialogs to players.
A form with a list of buttons with captions and images for presenting a set of options to a player.
A form with two-button that are functional for Yes/No or OK/Cancel questions.
A more flexible "questionnaire-style" list of controls in a form that can be used to take input.
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:
Use the Script API to send HTTP requests to the internet using the @minecraft/server-net
module.
Bedrock Editor with Editor Samples Add-On in Minecraft Preview v1.21.30 (August 2024)
The Minecraft Editor or the @minecraft/server-editor
module is a built-in JavaScript library for Editor extensions to build complex tools to build, edit, and test worlds. Currently, this API is only accessible in Bedrock Preview on Windows.
An Editor extension is a set of resource pack and behavior packs, like .mcaddon
files but for Editor, uses this API to perform most actions in the Bedrock Editor.
Here are some examples of what you can achieve with the Extension API:
Load configuration of variables and secrets in Bedrock Dedicated Server folder using Script API.
A Script API module that is used for debugging purposes. Currently features: