5. Custom Data - lilypuree/Metabolism GitHub Wiki
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
.
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
}
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 thanthis
. -
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.
-
When
is_additive
istrue
, the environment effect will be applied on top of other effects.If
is_additive
isfalse
, 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.
- Set
is_resistance
totrue
to create resistances. - positive heat target = cold resistance (raises temperature)
- negative heat target = heat resistance (lowers temperature)
- Set a positive number to create a ranged effect.
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"
}
- can be either
exposed
,rainy
,snowy
.-
exposed
: checks for sky visibility in the current location -
rainy
andsnowy
check for weather and sky visibility.
-
- a biome tag to check for.
- To specify a metabolite file for some edible item
namespace:food_name
, put a file namedfood_name.json
with the below properties in the pathnamespace/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
.
- All values are 0 by default.
-
float
value
-
float
value
-
float
value - The maximum amount of warmth that can be gained.
-
int
value - The level of the metabolism effect.
- Higher level effects give warmth faster and is able to change heat orbs back to warmth.
- 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
-