Fabric Resource Conditions
Fabric API resource conditions let the game load a data file only when some runtime condition holds: another mod is present, a tag is populated, a registry contains an entry, or a feature flag is enabled. Fabric reads them from a fabric:load_conditions array at the root of the JSON.
Kore can attach these conditions to any generator (recipes, advancements, loot tables, predicates, item modifiers, worldgen, ...). The array is injected at the JSON root during generation, so the same Kore code produces a plain datapack for vanilla and a conditionally-loaded one when shipped inside a Fabric mod.
This pairs well with generating straight into Fabric Loom's datagen folder, see Creating a DataPack.
Attaching conditions
Call fabricLoadConditions { } inside any generator builder. Each factory both creates a condition and adds it:
Produces:
Available conditions
| DSL call | Condition | Succeeds when |
|---|---|---|
allModsLoaded("a", "b") |
fabric:all_mods_loaded |
every listed mod is loaded |
anyModsLoaded("a", "b") |
fabric:any_mods_loaded |
at least one listed mod is loaded |
tagsPopulated("minecraft:logs") |
fabric:tags_populated |
every tag is populated (in minecraft:item by default) |
tagsPopulated("stone", registry = "minecraft:block") |
fabric:tags_populated |
every tag is populated in the given registry |
registryContains("mymod:custom") |
fabric:registry_contains |
the registry (minecraft:item by default) contains every id |
registryContains("mymod:tree", registry = "worldgen/configured_feature") |
fabric:registry_contains |
the given registry contains every id |
featuresEnabled("minecraft:vanilla") |
fabric:features_enabled |
every feature flag is enabled |
conditionTrue() |
fabric:true |
always |
Combinators
not(...) inverts a single condition. and { } and or { } open nested scopes that combine the conditions declared inside them:
The registry argument is optional and defaults to minecraft:item on the Fabric side, so it is omitted from the JSON when you leave it out.
Limitation: object-form resources only
Conditions are injected at the JSON root, which must be an object. That covers recipes, advancements, loot tables, and single-entry predicates or item modifiers.
Predicates and item modifiers with multiple entries serialize as a top-level JSON array, which has no root to attach fabric:load_conditions to. Kore emits a warning and generates the file without conditions in that case. Wrap the logic differently (for example a single allOf/anyOf predicate) if you need conditions on it.
