MariesWiki

Nourished Wiki · Datapack authors

Custom Nutrients

Define nutrients and customize their bars, tooltips, and colors with config, datapacks, or KubeJS.

Nourished supports custom nutrients from config, datapacks, and KubeJS. The nutrient definition sets its key and behavior; food mappings are separate, so adding a nutrient does not automatically classify any items.

Choose how to define the nutrient

Method File or API Fields
Config config/nourished/nutrients.json key, display_name, color, default_decay_rate, critical_threshold, low_threshold, excess_threshold, beneficial, icon, tags, tooltip_color
Datapack data/nourished/config/nutrients.json Uses the same nutrient definition format
KubeJS NourishedAPI.registerNutrient({...}) in a startup script id, displayName, color, decayRate, critical, low, excess, beneficial, icon, tags, tooltipColor, tooltipText

Config or datapack definition

The config file lives under config/nourished/. A datapack can provide the equivalent definition at data/nourished/config/nutrients.json.

config/nourished/nutrients.json
{
  "key": "sugar",
  "display_name": "Sugar",
  "color": "0xFFE07A5F",
  "default_decay_rate": 0.02,
  "critical_threshold": 0.1,
  "low_threshold": 0.25,
  "excess_threshold": 0.8,
  "beneficial": false,
  "icon": "minecraft:sugar",
  "tags": ["nourished:nutrients/sugar"]
}

The color uses ARGB hexadecimal notation. Definitions supplied through datapacks follow Nourished's datapack loading priority; see Datapack Support.

KubeJS definition

Register the nutrient in kubejs/startup_scripts/:

kubejs/startup_scripts/
NourishedAPI.registerNutrient({
  id: "fiber",
  displayName: "Fiber",
  color: 0x4E9F3D,
  decayRate: 0.02,
  critical: 0.1,
  low: 0.25,
  excess: 0.8,
  beneficial: true,
  icon: "minecraft:wheat",
  tags: ["nourished:nutrients/fiber"],
  tooltipColor: 0xFFAA00,
  tooltipText: "Fiber from plant-based foods."
});

Restart the game after changing startup registrations. A nutrient definition does not assign foods to that nutrient; add a food mapping or item tag as described in Datapack Support.

Add foods to the nutrient

Create an item tag whose name matches the nutrient key. For example, to add honey bottles to sugar:

your_datapack/
your_datapack/
└── data/
    └── nourished/
        └── tags/
            └── item/
                └── nutrients/
                    └── sugar.json
data/nourished/tags/item/nutrients/sugar.json
{
  "replace": false,
  "values": [
    { "id": "minecraft:honey_bottle", "required": false }
  ]
}

"replace": false adds to the existing tag entries rather than replacing them.

Customize the nutrient bar color

The color field sets the default bar color in config, datapack, or KubeJS definitions. In game, open Mod Options → Nourished → HUD Colors to override the color of any registered nutrient, including custom nutrients.

A datapack can also provide a color override for a nutrient that has already been registered. It cannot define the nutrient by changing a color alone.

Set tooltip text

There are three ways to provide nutrient tooltip text:

  1. Language file: Add nourished.screen.diet.tooltip.<key> to a resource pack or datapack language file. For sugar, use:

    assets/your_datapack/lang/en_us.json
    {
      "nourished.screen.diet.tooltip.sugar": "Added sugar from processed foods and sweets."
    }
  2. Tooltip message registry: Put an override in config/nourished/tooltips/tooltip_messages.json:

    config/nourished/tooltips/tooltip_messages.json
    {
      "byKey": {
        "sugar": "Added sugar from processed foods and sweets."
      },
      "byItem": {}
    }

    A datapack can provide the same structure at data/nourished/marie/tooltips/tooltip_messages.json. Datapack values take priority over config values.

  3. KubeJS: Set tooltipText when calling registerNutrient. This runtime registration takes priority over the config and datapack registry values.

If no tooltip text is set, Nourished displays guidance indicating which translation key to add.

Customize tooltip text color

tooltip_color sets the default tooltip text color independently from the nutrient bar color. KubeJS definitions can set the same value with tooltipColor. The HUD Colors options also have an independent tooltip color row for every registered nutrient.

config/nourished/nutrients.json
{
  "key": "sugar",
  "color": "0xFFE07A5F",
  "tooltip_color": "0xFFFF5555"
}

Other required nutrient fields are omitted from this example. The tooltip color uses the same ARGB hex format as the bar color. Only configured tooltip content is colored; the instructional fallback remains unstyled.

← Nourished Wiki home