Skip to content

Food Classification

TheIllusiveC4 edited this page Feb 18, 2021 · 4 revisions

Food classification into groups is done through item tags.

Please see the general overview of the tag system at the Minecraft wiki.

The tags follow the format diet:[group name].

Guided Walkthrough

Creating a data pack

In order to begin, we'll need to create a data pack first of all. Navigate to the world save in your Minecraft root folder, probably at .minecraft/saves/(world-name) and then navigate to the datapacks folder (or create one if it's not already there). If you're not using any data packs, this folder will be empty. Create a new folder for your data pack, call it anything you want. Then go into that folder, so you should be in .minecraft/saves/(world-name)/datapacks/(datapack-name).

Once you're inside, create a pack.mcmeta file, named exactly like that. Open the file and fill it with this:

{
  "pack": {
    "pack_format": 6,
    "description": "put a description here, or not"
  }
}

Once you're done, save it. You should be back at the data pack's root folder at .minecraft/saves/(world-name)/datapacks/(datapack-name). Now we're going to build out a few nested folders. Create a new folder in here named data, then another folder in data called diet, then another folder in diet called tags, then another in tags called items.

By this point, you should be in the .minecraft/saves/(world-name)/datapacks/(datapack-name)/data/diet/tags/items folder. That's it for the folder structure.

Creating a tag file

Now create a new file here called (insert group name here).json. If you're adding to a group called fruits, we would name it fruits.json. It's very important that the name matches the name of the group.

In this file, type this:

{
  "replace": false,
  "values": []
}

This is the basic structure for a tag file. replace dictates whether or not you're just adding tags or completely overriding tags. I recommend leaving this at false unless you know what you're doing. values is the property you're most interested in. This is where you list alllll of the items that you want to add to the group. For example, if you'd like to add an item called "examplemod:bacon":

{
  "replace": "false",
  "values": ["examplemod:bacon"]
}

You can put as many values as you want here but they must all be comma separated inside of the brackets. Like so:

{
  "replace": "false",
  "values": ["examplemod:bacon", "examplemod:cheese"]
}

If you do not know the registry name of the item you want to add, you can see it in-game by using F3+H to activate advanced tooltips and hovering over the item.

You can verify that you've added the item in properly by looking at the item's tooltip because the item will list the food groups they belong in.

And that's it! If you have any questions or need help troubleshooting, please feel free to contact the developer directly.

Clone this wiki locally