5. Custom Data - lilypuree/Metabolism GitHub Wiki

Overview

You can add/modify environment effects and metabolites using datapacks. The file structure of a metabolism datapack is as below:

show
(data pack name)  
 └ data 
  └ (namespace)
   └ environment_effects
    └ (environment_effect_name).json
   └ metabolites
    └ (item_path).json
  • Environment effects and metabolites are not loaded if the mod that has (namespace) as its modid isn't present!
  • Custom standalone datapacks should add new environment effects to the namespace metabolism.

Environment Effects

Examples

Heat effect (nether)
{
  "conditions": [
    {
      "condition": "minecraft:location_check",
      "predicate": {
        "dimension": "minecraft:the_nether"
      }
    }
  ],
  "heat_target": 8.0
}
Additive effect (water)
{
  "conditions": [
    {
      "condition": "minecraft:entity_properties",
      "entity": "this",
      "predicate": {
        "location": {
          "fluid": {
            "tag": "minecraft:water"
          }
        }
      }
    }
  ],
  "is_additive": true,
  "heat_target": -4.0
}
Ranged effect (campfire)
{
  "conditions": {
    "condition": "minecraft:location_check",
    "predicate": {
      "block": {
        "blocks": [
          "minecraft:campfire"
        ],
        "state": {
          "lit": "true"
        }
      }
    }
  },
  "warmth_effect": 1.0,
  "is_resistance": true,
  "heat_target": 3.0,
  "range": 4.0
}
Heat resistance (gold armor)
{
  "conditions": {
    "condition" : "any_of",
    "terms": [
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "head": {
              "items": [
                "minecraft:golden_helmet"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "chest": {
              "items": [
                "minecraft:golden_chestplate"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "legs": {
              "items": [
                "minecraft:golden_leggings"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "feet": {
              "items": [
                "minecraft:golden_boots"
              ]
            }
          }
        }
      }
    ]
  },
  "is_resistance": true,
  "is_additive": true,
  "heat_target": -3.0
}
Cold resistance (leather armor)
{
  "conditions": {
    "condition" : "any_of",
    "terms": [
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "head": {
              "items": [
                "minecraft:leather_helmet"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "chest": {
              "items": [
                "minecraft:leather_chestplate"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "legs": {
              "items": [
                "minecraft:leather_leggings"
              ]
            }
          }
        }
      },
      {
        "condition": "minecraft:entity_properties",
        "entity": "this",
        "predicate": {
          "equipment": {
            "feet": {
              "items": [
                "minecraft:leather_boots"
              ]
            }
          }
        }
      }
    ]
  },
  "is_resistance": true,
  "is_additive": true,
  "heat_target": 3.0
}

Properties

1. conditions

A single or list of predicates, also called loot conditions, that must all pass for the effect to be applied. Local(non-ranged) and ranged effects use this property differently.

  • Local effects

    The loot context type with which the predicates are invoked is selector, which means that you cannot use predicates that require the Damage source, Blockstate, Tool, or an Entity other than this.

  • Ranged effects

    For ranged effects, the predicate must be a single location_check condition, which will be evaluated for positions surrounding the player within the specified range.

2. is_additive

  • When is_additive is true, the environment effect will be applied on top of other effects.

    If is_additive is false, it will only be applied when it is the hottest/coldest/warmest of all effects. This is useful for ranged effects that should not be applied more than once.

    additivity is set to false if not specified.

3. is_resistance

  • Set is_resistance to true to create resistances.
  • positive heat target = cold resistance (raises temperature)
  • negative heat target = heat resistance (lowers temperature)  

4. range

  • Set a positive number to create a ranged effect.

5. heat_target

6. warmth_effect

7. night_multiplier


Advanced Location Check

Metabolism adds a custom predicate type for checks not present in vanilla loot conditions.

   {
      "condition": "metabolism:advanced_location_check",
      "type" : "exposed",
      "biome_tag": "metabolism:hot_biomes"
    }

type (optional)

  • can be either exposed, rainy, snowy.
    • exposed : checks for sky visibility in the current location
    • rainy and snowy check for weather and sky visibility.

biome tag (optional)

  • a biome tag to check for.

Metabolites

  • To specify a metabolite file for some edible item namespace:food_name, put a file named food_name.json with the below properties in the path namespace/metabolites/food_name.json.
  • The metabolite file for water bottles is minecraft/metabolites/potion.json.
  • The metabolite file for a cake slice is minecraft/metabolites/cake.json.

Properties

  • All values are 0 by default.

1. food

  • float value

2. hydration

  • float value

3. warmth

  • float value
  • The maximum amount of warmth that can be gained.

4. amplifier

  • int value
  • The level of the metabolism effect.
  • Higher level effects give warmth faster and is able to change heat orbs back to warmth.

5. modifier(optional)

  • A json object that contains the following optional properties.
  • If a property is specified in a modifier object, the target item's stack size/food properties will be modified accordingly.
    • stack_size: int value
    • eat_when_full: boolean value
    • fast_eating: boolean value
⚠️ **GitHub.com Fallback** ⚠️