Create Your Own Data Pack
Data packs let you customize Minecraft without mods. You can change recipes, loot tables, advancements, world generation, and run commands with functions. Here is how to get started.
What You Need
Text Editor
VS Code, Notepad++, or any text editor that can save as .json and .mcfunction files.
Minecraft Java Edition
Data packs only work on Java Edition. Bedrock uses behavior packs instead.
Basic JSON Knowledge
Data packs use JSON for recipes, loot tables, and configuration. Functions use mcfunction syntax.
Folder Structure
Every data pack needs a specific folder structure. Here is the basic layout:
my_datapack/
pack.mcmeta
pack.png (optional icon)
data/
minecraft/
recipes/
my_recipe.json
loot_tables/
...
tags/
...
my_namespace/
functions/
my_function.mcfunction
advancements/
...The pack.mcmeta File
This file tells Minecraft that this folder is a data pack. It goes in the root of your data pack folder.
{
"pack": {
"pack_format": 48,
"description": "My first data pack"
}
}pack_format values
| Format | Minecraft Version |
|---|---|
| 15 | 1.20 - 1.20.1 |
| 26 | 1.20.3 - 1.20.4 |
| 48 | 1.21 - 1.21.1 |
| 57 | 1.21.4 |
Example: Custom Recipe
To add a custom recipe, create a JSON file at data/minecraft/recipes/my_recipe.json. Here is an example that lets you craft 4 oak planks from 1 stick:
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{ "item": "minecraft:stick" }
],
"result": {
"id": "minecraft:oak_planks",
"count": 4
}
}Example: Functions
Functions let you run multiple commands at once. Create a file at data/my_pack/functions/hello.mcfunction:
# Greet the player say Hello from my data pack! give @s minecraft:diamond 1 effect give @s minecraft:speed 60 1 true
Run your function in-game with: /function my_pack:hello
Example: Custom Loot Table
To change what a mob drops, override its loot table. Place the file at data/minecraft/loot_tables/entities/creeper.json to change creeper drops:
{
"type": "minecraft:entity",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:tnt",
"functions": [
{
"function": "minecraft:set_count",
"count": { "min": 1, "max": 3 }
}
]
}
]
}
]
}Tips for Data Pack Development
- Use a unique namespace for your data pack to avoid conflicts with other packs.
- Test changes with /reload instead of restarting the game every time.
- Use /datapack disable to quickly turn off a broken pack without deleting it.
- JSON files must be valid JSON. Use a JSON validator if your pack does not load.
- Functions run as the server, not as a player. Use @s only when executed by a player.
- Start simple with one recipe or loot table change before building complex systems.
- Use the Minecraft Wiki as your reference for all JSON formats and available options.
- Keep your file and folder names lowercase with underscores. No spaces allowed.
Want inspiration?
Browse existing data packs to see what is possible and learn from their design.
Browse Data Packs