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, advancements, loot tables, 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
     }
   ]
 }
 

Unknown/invalid conditions will be skipped and considered successful.

Data generation integration

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