Modding Minecraft Pocket Edition has been easily achieved by writing simple JavaScript files for ages, but obviously this isn’t ideal for developing the complex mods popular now.

Enter Node

By using a combination of NodeJS and various build tools, we can easily build complex ModPE mods. This allows us to import third-party modules and structure multiple files in a maintainable way.

Possibly the greatest benefit of this is the ability to require modules. Developers can now use libraries in the ModPE packages, such as the inform library.

1
2
3
4
5
6
7
8
9
const inform = require('inform');
const globe = require('modpe-globe');

globe.newLevel = () => {
let scripts = inform.all();
for (script in scripts) {
scripts[script].call('customHook');
}
}

Obviously, these are just Node modules, however the majority of NPM packages wouldn’t behave as expected in the ModPE environment.

But how?

The important thing to remember is to use Browserify, and if using ES6, Babelify is also essential.

This whole setup, with Grunt, is available as a skeleton here.

One downside of Browserify in this usage is that inability for the ModPE engine to call hooks, such as newLevel, useItem, etc. This is easily overcome by utilising the ‘modpe-globe’ module, as shown in the demo code above. This simply provides an entrance to the world outside of the Browserify realm.


Moving from unweildy & lengthy ModPE scripts to cleaner & organised Node projects is now the smart way to go, especially, when paired with any build tool. Whether it’s feasible for the average ModPE developer is the next question.