MDL Icon 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

📥 Downloads

Get the latest version and VS Code extension

Download Install
Download Now →

🚀 Getting Started

Install and create your first datapack

Beginner Setup
Get Started →

📖 Language Reference

Complete MDL syntax guide

Reference Syntax
Learn MDL →

📚 Examples

Working examples of all features

Examples Code
View Examples →

💻 CLI Reference

Command-line tool usage

Tools CLI
CLI Guide →

🔧 VS Code Extension

IDE integration and features

IDE VS Code
VS Code →

📁 Multi-file Projects

Organize large projects

Advanced Structure
Learn More →

🐍 Python API

Programmatic datapack creation

API Python
Python API →

🎯 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

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

  1. Install MDL: pipx install minecraft-datapack-language
  2. Create your first datapack: Follow the Getting Started Guide
  3. Learn the language: Check the Language Reference
  4. See examples: Explore Working Examples
  5. Build projects: Use Multi-file Projects

Community

License

MDL is open source software licensed under the MIT License. See the LICENSE file for details.