Package net.fabricmc.fabric.api.resource.conditions.v1


package net.fabricmc.fabric.api.resource.conditions.v1
Provides a way of conditionally loading JSON-based resources. By default, this can be used with recipes, loot tables, advancements, predicates, and item modifiers. Conditions are identified by an identifier and registered at ResourceConditions.

JSON format

Add an array with the fabric:load_conditions key to the JSON file:


 {
   "type": "minecraft:crafting_shapeless",
   "ingredients": [
     {
       "item": "minecraft:dirt"
     }
   ],
   "result": {
     "item": "minecraft:diamond"
   },
   "fabric:load_conditions": [
     {
       "condition": "<insert condition ID here>",
       // values of the condition
     }
   ]
 }
 

See DefaultResourceConditions for the list of built-in conditions. It is also possible to register a custom condition.

Data generation integration

Fabric Data Generation API supports adding a ConditionJsonProvider to a generated file. Please check the documentation of the Data Generation API.