-
Notifications
You must be signed in to change notification settings - Fork 4
Worldgen Modifier Load Conditions
Let's say you wanted to add a rock
feature to Terralith's Forested Highlands biome. Your worldgen modifier may look like this:
{
"type": "lithostitched:add_features",
"biomes": "terralith:forested_highlands",
"features": "my_mod:rock",
"step": "vegetal_decoration"
}
The game will throw an error when loading the pack if Terralith isn't installed because it can't find the terralith:forested_highlands
biome. Using load conditions, we can tell the game to simply not load the modifier file if Terralith isn't installed.
In 1.20, Fabric doesn't support load conditions for custom files like worldgen modifiers. To bridge that gap, Lithostitched has modifier predicates in this version.
{
"predicate": {
"type": "lithostitched:mod_loaded",
"mod_id": "terralith"
},
"type": "lithostitched:add_features",
"biomes": "terralith:forested_highlands",
"features": "my_mod:rock",
"step": "vegetal_decoration"
}
All modifier predicates have a type
field, indicating the modifier type to use. Each modifier can add more fields if it needs to.
The built-in modifier types are as follows:
-
all_of
: All modifier predicates in thepredicates
list of this modifier predicate must pass for this modifier to pass. -
any_of
: At least one of the modifier predicates in thepredicates
list of this modifier predicate must pass for this modifier to pass. -
not
: The modifier predicate in thepredicate
field of this modifier predicate must fail for this modifier to pass. -
mod_loaded
: A mod with the id in themod_id
field must be installed for this modifier to pass. -
true
: This modifier predicate always passes.
In 1.21, both Fabric and Neoforge support their own load conditions for custom files like worldgen modifiers.
Neoforge has a documentation page on their format, and Fabric has javadocs on their format. If you're building a datapack/mod for both Fabric and Forge, the modifier above can be modified to this to fix it:
{
"fabric:load_conditions": {
"condition": "fabric:all_mods_loaded",
"values": [
"terralith"
]
},
"neoforge:conditions": [
{
"type": "neoforge:mod_loaded",
"modid": "terralith"
}
],
"type": "lithostitched:add_features",
"biomes": "terralith:forested_highlands",
"features": "my_mod:rock",
"step": "vegetal_decoration"
}
All json here can be generated using the Lithostitched generator website!