Typescript is very beneficial to use when developing scripts for Minecraft addons. There exist libraries to aid in the development of Minecraft addons to provide intellisense and type-safety for broadcasting and listening to events.
How it Works
.ts file. Therefore some tooling needs to be set up in order to utilize TypeScript to build addons.
Since there is already a build step, we might as well incorporate some other systems to allow for file separation and code sharing between the
server. Minecraft's scripting system will only act on the
You do not need to know how to utilize these tools since there are already libraries that utilize them for you without any effort on your behalf. It is just important to understand the tooling making these sorts of libraries possible.
- Beginners Guide Prerequisites
- Knowledge of TypeScript and read through the Beginners Guide
This guide is for setting up and using the minecraft-addon-toolchain as it currently provides the most tooling with the easiest setup.
Open a terminal (Command Prompt for Windows) and navigate to where the project should be located. It can be anywhere. For Windows 10 you can also
Shift + RClick in file explorer and select
Open in PowerShell.
Next we need to install the template generator for creating the addon. To do this, enter the following commands.
npm install -g yeoman
npm install -g generator-minecraft-addon
If you receive an error such as
command npm not found, ensure you have Node.js installed and added to the PATH.
Now the project can be initialized. The next step is to generate the project with all the information you define.
Now that you created the project, it can be opened in your IDE of choice. If you are utilizing VS Code, you can
cd into your project directory and run
code . to open your project.
Unless you know what you are doing, the only part of the project to be concerned with is everything within the
packs folder. That is where all the development should take place.
The following commands are most utilized when developing a project using
npm run installaddon
installaddon will, as it says, install the addon into the
development resource/behaviors folders. The pack can then be utilized like any other addon.
npm run watch
watch will watch for any changes you make within the
packs directory and automatically reinstall the addon.
npm run packageaddon
packageaddon will build, package, and zip the addon in a connivent manner. By default, outputs to