npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minecraft-scripting-toolchain

v0.1.0

Published

Productivity tools for making Minecraft Bedrock Edition mods

Downloads

2

Readme

minecraft-scripting-toolchain

Helps with some common tasks when building a minecraft mod for Bedrock edition:

  • builds an mcaddon directory (incomplete)
  • installs the mod into Minecraft for Windows 10's development folders
  • watches for file changes and reinstalls as neccessary
  • has extension points to do transpilation
  • (not implemented) build a .mcaddon

Prerequisites

| Software | Minimum | Recommended | | ----------- | ------------------------------------------- | --------------------------------------------------------- | | Minecraft | Minecraft on your Windows 10 device | Minecraft on your Windows 10 device | | Storage | 1.0 GB of free space for text editor, game, and scripts | 3.0 GB of free space for Visual Studio, game, and scripts | | Node.js | 8.x | 10.x |

Getting Started

Ensure you have a package.json file present in your development directory, if you do not, you can create a minimal valid package with the following contents:

{
  "private": "true",
}

install the package (It's not currently available on NPM, you'll have to use the Github repository)

npm install --save-dev github:minecraft-addon-tools/minecraft-scripting-toolchain

This will automatically install gulp vNext (4.0.0)

Create a gulpfile.js gulp configuration

use the following as a template for your gulpfile.js, replacing <yourmodname> with the name of your mod, which will be used on the filesystem to identify your mod

const MinecraftModBuilder = require("minecraft-scripting-toolchain")

const modBuilder = new MinecraftModBuilder(<yourmodname>);
module.exports = modBuilder.configureEverythingForMe();

The MinecraftModBuilder object can be used to create your own tasks, but the default tasks configured by configureEverythingForMe() should be sufficient for simple mods.

Next, update your packge.json with appropriate scripts, here are some useful scripts

  "scripts": {
    "build": "gulp build",
    "installmod": "gulp install",
    "rebuild": "gulp rebuild",
    "watch": "gulp watch"
  },
  • use npm run build to create the directory structure for a .mcaddon
  • use npm run installmod to install the mod into Minecraft for Windows 10
  • use npm run rebuild to clean the build directory and rebuild it
  • use npm run watch to:
    • build the project
    • deploy it to to Minecraft for Windows 10
    • monitor for changes on the filesystem
      • automatically rebuilds and deploys the project.

Conventions

These scripts will assume a certain directory structure by default. These can be overridden by altering properties on the MinecraftModBuilder object in your gulpfile.js.

| directory | purpose | config property | |-----------|---------|-----------------| | .\src\scripts | Any JavaScript/TypeScript/etc files that make up the code | scriptsDir | | .\src\behaviors | files that are part of the behaviors | behaviorDir | | .\src\resources | files that are part of the resources | resourceDir | | .\built | the constructed mcaddon directory | outDir |

an example of changing the build directory would look something like this:

const MinecraftModBuilder = require("minecraft-scripting-toolchain")
const modBuilder = new MinecraftModBuilder(<yourmodname>);
modBuilder.outDir = "./out"

Using with TypeScript

It is recommended if you use TypeScript to use the minecraft-scripting-types packge to give better code hints, see minecraft-addon-tools/minecraft-script-types for more details. The following steps will assume this is also installed.

Install the prerequisites to get started

npm install --save-dev gulp-typescript

Now edit your gulpfile.js and add typescript to the scriptTasks setting on the MinecraftModBuilder (again remembering to replace <yourmodname> as appropriate):

const ts = require("gulp-typescript");
const MinecraftModBuilder = require("minecraft-scripting-toolchain")

const modBuilder = new MinecraftModBuilder(<yourmodname>);

compileTypeScript = () => ts({
    module: "ES6" //Must be ES6 because otherwise code gets generated that Minecraft doesn't support
    noImplicitAny: true,
    types: [ "minecraft-scripting-types" ] // You won't need this line if you're not using the types
});

modBuilder.scriptTasks = [compileTypeScript];

module.exports = modBuilder.configureEverythingForMe();

Note that compileTypeScript is a function, not just a call to ts failing to do this will result in gulp and gulp-typescript trying to re-use a completed set of files and failing.