Skip to main content

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

FormatMinecraft Version
151.20 - 1.20.1
261.20.3 - 1.20.4
481.21 - 1.21.1
571.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

Want inspiration?

Browse existing data packs to see what is possible and learn from their design.

Browse Data Packs