Skip to content

Setting Food Values

Jeremy edited this page Oct 3, 2026 · 3 revisions

This page explains how to set specific food group values for individual foods.

Overview

By default, A Balanced Diet calculates how much a food increases its food groups from the food's hunger and saturation values, then splits that amount equally between every food group the food belongs to (see Categorizing Food to Groups). For example, a fruit salad made mostly of fruit with one slice of pumpkin would increase fruits and vegetables by the same amount. Food values let you set exactly how much each food increases each of its food groups instead.

Because every food's values have to be set by hand, food values are disabled by default. To use them, enable the enableDataFoodValues option in the server config. Foods with a food value use it in place of the calculated amount, and foods without one still use their item tags.

Food values can also be given to drinks and other items that don't restore hunger, as long as they use the eating or drinking animation. These items only increase food groups through food values.

Note

Food values are added directly to the food group and are not affected by the food group's gain_multiplier.

Directory

Food values are defined as .json files located in the data/[namespace]/diet/food_values/ folder of the datapack. See Using Datapacks for information about how to create and activate datapacks.

The file name for a food value file can be anything, but the built-in files are split up by mod namespace (like minecraft.json or farmersdelight.json). Each food value file can hold any number of foods.

Note

[namespace] should be replaced by the namespace chosen for this portion of the datapack. If this is part of a mod, the namespace is usually the mod ID. If this is part of a user-defined datapack, the namespace can be any lowercase string with no special characters.

Fields

The food values .json file includes a top-level JSON object which holds two potential fields.

Field Type Default Required Description
replace boolean false No If true, this file will replace the same file in lower priority datapacks instead of adding to it (see Load Order).
values object {} No The foods to set values for (see below).

Each key in values is either an item's registry name (like "minecraft:apple") or an item tag (like "#examplemod:legumes"). Each key's value is an object that maps food group IDs to how much that food group increases.

Warning

If any part of a food values file has an error, the whole file is skipped and the error is printed to the log.

Example

{
  "replace": false,
  "values": {
    "minecraft:apple": {
      "fruits": 0.03
    },
    "minecraft:pumpkin_pie": {
      "proteins": 0.03,
      "sugars": 0.16,
      "vegetables": 0.08
    },
    "minecraft:milk_bucket": {
      "proteins": 0.12
    }
  }
}

This file defines these food values:

  • Eating an apple increases fruits by 3%
  • Eating pumpkin pie increases proteins by 3%, sugars by 16%, and vegetables by 8%
  • Drinking a milk bucket increases proteins by 12%

Load Order

Food value files are loaded similarly to vanilla tags. The same file in multiple datapacks will be merged, in order of priority. Setting replace to true discards any versions of that file from lower priority datapacks, so only the files loaded later are used.

If an item is found in multiple files, the values in the highest priority datapack are used. An item entry takes priority over that same item included in a tag.

Built-in Food Values

A Balanced Diet includes food values for vanilla Minecraft as well as about 20 mods. These values assume a decreased drain rate for fruits and vegetables, and greatly increased drain rates for sugars. The full list of built-in files can be viewed in the mod's default datapack.

Clone this wiki locally