Module Structure

Creating Modules

Any directory within data/modular_mc that contains a _map.ts file becomes a module. The _map.ts file defines how the module’s files should be processed and where they should be exported.

Basic Module Structure

Example below creates a module called my_entity that contains files related to a zombie entity.

πŸ“‚ data/modular_mc/
    πŸ“‚ my_entity/
        βš™οΈ _map.ts          # Required - defines the module
        πŸ“„ zombie.behavior.json
        πŸ“„ zombie.geo.json
        πŸ–ΌοΈ zombie.entity.png
        πŸ“„ zombie_attack.animation.json

Modules can have any structure you want. Subdirectories are allowed for better organization.

Nested Modules

You can put modules inside other modules. This way a big module can have smaller parts that still can be easily exported to other projects.

πŸ“‚ data/modular_mc/
    πŸ“‚ magic/                        # Parent module (module A)
        βš™οΈ _map.ts
        πŸ“„ projectile.ts             # Shared script used by submodules
        πŸ“‚ fireball/                 # Nested module (module B)
            βš™οΈ _map.ts
            πŸ“„ fireball.entity.json
            πŸ“„ fireball.geo.json
            πŸ–ΌοΈ fireball.entity.png
        πŸ“‚ magic_missile/            # Nested module (module C)
            βš™οΈ _map.ts
            πŸ“„ magic_missile.particle.json
            πŸ“„ magic_missile.ts

Each directory with a _map.ts file is processed as an independent module, regardless of nesting level.

Module Processing Order

Modules are processed in alphabetical order based on their full path. With the structure above, the processing order would be:

  1. magic/

  2. magic/fireball/

  3. magic/magic_missile/

This consistent ordering ensures predictable behavior when multiple modules might affect the same output files.