-
Notifications
You must be signed in to change notification settings - Fork 15
Load Predicates
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 predicates, we can tell the game to simply not load the modifier file if Terralith isn't installed.
Load predicates can be added to most datapack files, but are meant for use with Worldgen Modifiers and Biome Injectors. For example, the above modifier can be fixed like this:
{
"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: Passes if all predicates in thepredicatesfield pass. -
any_of: Passes if at least one predicate in thepredicatesfield passes. -
not: Passes if the predicate in thepredicatefield fails. -
mod_loaded: Passes if a mod with the mod id in themod_idfield is present. -
loader: Passes if the modloader's id matches the string in theloaderfield. -
pack_format: Passes if the pack format is within the range from thesupported_formatsfield. -
true: Always passes.
All json here can be generated using the Lithostitched generator website!