Skip to content
colduw edited this page Nov 5, 2026 · 1 revision

Creating a new datapack

Since version 2.0.0-beta, Diet uses datapacks for groups and effects. The following example will create a new group with the "gapple" name.

1. Creating the pack

inside minecraft/saves/[world]/datapacks:

GappleDiet/
           data/
           |   dietplus/
           |            tags/
           |                 items/
           |                       gapple.json
           |   gapplediet/
           |              dietplus/
           |                       groups/
           |                       |      gapple.json
           |                       suites/
           |                       |      builtin.json
           pack.mcmeta

The GappleDiet/pack.mcmeta is mandatory, put the following in it

{
  "pack": {
    "description": "Example datapack for Minecraft 1.20.2 Diet",
    "pack_format": 18
  }
}

data/dietplus/tags/items/gapple.json houses all items that are going to be contributed to the "gapple" group when eaten, for example:

{
    "values": [
        "minecraft:golden_apple",
        "minecraft:enchanted_golden_apple"
    ]
}

data/gapplediet/dietplus/groups/gapple.json defines the group's specifications, for example:

{
  "display_name": "Gapples",
  "icon": "minecraft:enchanted_golden_apple",
  "color": "#ffff00",
  "order": 20,
  "default_value": 0.0,
  "gain_multiplier": 1.0,
  "decay_multiplier": 1.0,
  "beneficial": true
}

if display_name is empty, it will fallback to localization first, then the default group name


data/gapplediet/dietplus/suites/builtin.json defines how the group effects the player, for example:

{
  "replace": false,
  "groups": [
    "gapple"
  ],
  "effects": [
    {
      "attributes": [
        {
          "name": "minecraft:generic.max_health",
          "operation": "add",
          "amount": 20.0
        }
      ],
      "conditions": [
        {
          "groups": ["gapple"],
          "match": "all",
          "above": 0.2,
          "below": 1.0
        }
      ]
    }
  ]
}

Will give +20 hearts to the player if the gapple group is above 20% (0.2), and below 100% (1.0). To match any group, use every instead of all

Other operations include: multiply_base, and multiply_total.

2. Applying the pack

Place the GappleDiet folder inside the world's datapacks folder, usually inside minecraft/saves/[world]/datapacks. (in multiplayer/on a dedicated server, it's usually just [world]/datapacks)

For more information about importing datapacks: https://minecraft.wiki/w/Tutorial:Importing_a_data_pack

After it's placed, you can check via /datapack list, and enable with /datapack enable "file/GappleDiet".

Note

using /reload should make the pack work then and there, but a full restart is recommended.

For more general information, read the minecraft wiki's entry on Datapacks: https://minecraft.wiki/w/Data_pack


Caution

This tutorial was made for/in 1.20.2. In later versions, some features were changed in how datapacks need to be formatted.


In 1.20.6, operation names got changed.

  • multiply_total -> add_multiplied_total
  • multiply_base -> add_multiplied_base
  • add is not affected, as if the operation doesn't match either of the aforementioned ones, it results to add.

In 1.21, the items folder was renamed

  • tags/items -> tags/item

In 1.21.2, the generic. prefix was dropped from attribute IDs.

  • minecraft:generic.max_health -> minecraft:max_health

Clone this wiki locally