Minecraft Datapack Language (MDL)
A modern JavaScript-style compiler that lets you write Minecraft datapacks with real control structures, variables, and expressions that actually work.
Quick Navigation
🎯 JavaScript-Style Syntax
Write datapacks with modern curly braces, semicolons, and familiar syntax
🔄 Real Control Structures
Full if/else if/else statements and while loops that actually work
🔢 Variables & Expressions
Number variables with arithmetic operations and variable substitution
⚡ Modern Minecraft
Pack format 82 by default with latest Minecraft features
🔧 VS Code Support
Syntax highlighting, error checking, and quick compile with our VS Code extension
📁 Multi-file Support
Organize large projects across multiple files with automatic merging
Quick Start
Install
# Using pipx (recommended)
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install minecraft-datapack-language
# Or using pip
pip install minecraft-datapack-language
Create Your First Datapack
// hello.mdl
pack "My First Pack" "A simple example" 82;
namespace "example";
var num counter = 0;
function "hello" {
say Hello, Minecraft!;
tellraw @a {"text":"Welcome to my datapack!","color":"green"};
counter = counter + 1;
say Counter: $counter$;
}
on_load "example:hello";
Build and Run
# Build the datapack
mdl build --mdl hello.mdl -o dist
# Copy to Minecraft world
# Copy dist/my_first_pack/ to your world's datapacks folder
# Run /reload in-game
Why MDL?
Traditional Datapacks vs MDL
Traditional Minecraft Functions:
# Hard to read and maintain
scoreboard players add @s counter 1
execute if score @s counter matches 5.. run say High counter!
execute unless score @s counter matches 5.. run say Low counter!
MDL:
// Clean, readable, and maintainable
counter = counter + 1;
if "$counter$ > 5" {
say High counter!;
} else {
say Low counter!;
}
Key Benefits
- 🎯 Familiar Syntax: JavaScript-style with curly braces and semicolons
- 🔄 Real Control Flow: If/else statements and loops that actually work
- 🔢 Variables: Number variables with expressions and arithmetic
- 📁 Organization: Multi-file projects with proper namespace separation
- ⚡ Performance: Efficient compilation to optimized Minecraft commands
- 🔧 Tooling: VS Code extension with syntax highlighting and error checking
- 📚 Documentation: Comprehensive guides and working examples
Features
Control Structures
Write real if/else statements and while loops:
if "$health$ < 10" {
say Health is low!;
effect give @s minecraft:regeneration 10 1;
} else if "$health$ < 20" {
say Health is moderate;
} else {
say Health is good!;
}
while "$counter$ < 10" {
say Counter: $counter$;
counter = counter + 1;
}
Variables and Expressions
Use number variables with arithmetic operations:
var num player_health = 20;
var num damage = 5;
var num final_damage = damage * 2;
player_health = player_health - final_damage;
say Health: $player_health$;
Multi-file Projects
Organize large projects across multiple files:
// main.mdl
pack "My Game" description "A complete game" pack_format 82;
namespace "game";
// Main game logic
// ui.mdl (no pack declaration needed)
namespace "ui";
// User interface code
// combat.mdl (no pack declaration needed)
namespace "combat";
// Combat system code
Registry Support
Reference external JSON files for all Minecraft registry types:
recipe "custom_sword" "recipes/sword.json";
loot_table "treasure" "loot_tables/treasure.json";
advancement "first_sword" "advancements/sword.json";
Getting Started
- Install MDL:
pipx install minecraft-datapack-language
- Create your first datapack: Follow the Getting Started Guide
- Learn the language: Check the Language Reference
- See examples: Explore Working Examples
- Build projects: Use Multi-file Projects
Community
- Website: www.mcmdl.com
- GitHub: Source Code
- Issues: Report Bugs
- Discussions: Ask Questions
- Contributing: Help Improve MDL
License
MDL is open source software licensed under the MIT License. See the LICENSE file for details.