Share via

Minecraft Editor Script Box

This sample makes it easy to experiment with JavaScript code in the context of the Minecraft Edutir. Just add your code in the function at ScriptBox.ts, and this sample will add some infrastructure around it to make it easy to run that sample in within the editor experience.

Prerequisites

Install Node.js tools, if you haven't already

We're going to use the package manager npm to get more tools to make the process of building our project easier.

Visit https://nodejs.org/.

Download the version with "LTS" next to the number and install it. (LTS stands for Long Term Support, if you're curious.) In the Node.js Windows installer, accept the installation defaults. You do not need to install any additional tools for Native compilation.

Install Visual Studio Code, if you haven't already

Visit the Visual Studio Code website and install Visual Studio Code.

Getting Started

  1. Use npm to install dependent modules:

    npm i
    
  2. Use this shortcut command to open the project in Visual Studio Code:

    code .
    

Chapter 2. Let's test the parts of our project

Within the root folder (script-box) of this sample, run this command:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Run this one, too.

npm run local-deploy

Create an addon file to share.

npm run mcaddon

Manifest

  • just.config.ts: This file contains build instructions for just-scripts, for building out TypeScript code.
  • scripts: This contains Script Box TypeScript files for the Editor, that will be compiled and built into your projects.
  • behavior_packs: This contains resources and JSON files that define your behavior pack.