modexpedite v1.1.0-beta.0
We know why you're here.
ModExpedite is a TypeScript framework completely modular to write Minecraft Bedrock Add-Ons at the speed of light.
Aren't you tired of having to repeat lots of JSON in your Minecraft Add-Ons? ModExpedite is here to solve that problem for you once and for all.
The ModExpedite framework is shipped with a bunch of functionalities that will help you achieve whatever you want, no matter how custom it is. This is made through a series of concepts:
- Generators: TypeScript classes that generate files and puts them in your Add-On.
- Factories: TypeScript classes that fill the generators with data.
- Plugins: TypeScript classes that go inside the factories and automate tasks like adding the repetitive code.
You will learn more about this below, but first, lets create a project.
Prerequisites
This project runs with Bun, so the only thing needed here is to have Bun installed.
Super Easy Installation
bunx modexpedite
Thats it, the console will then ask you for some information about your Add-On.
Start a project
Inside your folder generated by the bux modexpedite
command, run the following command from terminal:
bun start
The project will start and the ModExpedite compiler will be listening to changes. Each time you do a change to the index.ts
file, the project will re-compile.
Add a block
Adding blocks is simple. First, create a BlockFactory object in your index.ts
. Underneath, factories are objects that will create a "generator" of certain type. Remember a generator is just a piece of code that writes a file into your Add-On.
import { BlockBasicTexturePlugin, BlockFactory, modExCore } from 'modexpedite';
import './modexpedite.config';
new BlockFactory({
name: 'test_block',
plugins: [],
});
modExCore.getInstance().build(); // Command to start the build process
Now an empty block will be created. But who wants an empty block? No one. Lets add textures:
import { BlockBasicTexturePlugin, BlockFactory, modExCore } from 'modexpedite';
import './modexpedite.config';
new BlockFactory({
name: 'test_block',
plugins: [
new BlockBasicTexturePlugin({
texture: 'block',
}),
],
});
modExCore.getInstance().build(); // Command to start the build process
We are adding a plugin to the BlockFactory that automatically handles all the block texture creation and edits the necessary files to add a texture to our block.
Now on your root folder go to the "assets" folder and put inside texture called "block.png".
Save the file and it will produce a Minecraft Bedrock block.
Make your own plugin
Its super easy to design your own plugins and get them to work repeatedly. For example, in a new file:
export class BlockCollisionBoxPlugin extends BasePlugin<BlockGenerator> {
async run(block: BlockGenerator): Promise<void> {
// This will modify a block and add a 1x1x1 collision component
block.blockBehavior['minecraft:block'].components[
'minecraft:collision_box'
] = {
origin: [0, 0, 0],
size: [1, 1, 1],
};
}
}
Now, to add this plugin simply do:
import { BlockCollisionBoxPlugin } from 'your-plugin-file';
new BlockFactory({
name: 'test_block',
plugins: [
new BlockBasicTexturePlugin({
texture: 'block',
}),
new BlockCollisionBoxPlugin(), // That easy
// You can even run plugins without creating classes like so:
{
async run(obj) {
obj.blockBehavior['minecraft:block'].components[
'minecraft:display_name'
] = 'A block';
},
},
],
});
Doing the previous steps, you can end up with a block JSON file that looks like this:
{
"format_version": "1.19.40",
"minecraft:block": {
"description": {
"identifier": "company_project:test_block"
},
"components": {
"minecraft:geometry": {
"identifier": "minecraft:geometry.full_block"
},
"minecraft:material_instances": {
"*": {
"texture": "b_test_block"
}
},
"minecraft:display_name": "A block"
}
}
}
Thats it! This is work in progress...
Altough due to the framework architecture, this is completely modular and you can create your own generators, factories and modules.
Please contact us on Discord: lancelotf to know more details about the infraestructure and how you can contribute.
Happy Coding!