User Tools

Site Tools


drafts:resourceconditions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
drafts:resourceconditions [2026/03/04 03:23] – Add custom condition infinitychancesdrafts:resourceconditions [2026/03/20 17:27] (current) – changed example again to not require build script changes infinitychances
Line 215: Line 215:
 This section will assume you have already set up a basic datagen setup. It will use recipes as an example. This section will assume you have already set up a basic datagen setup. It will use recipes as an example.
  
-We will create a custom shaped recipe that turns fried egg from farmer's delight refabricated into an egg with a water bucket and only when the mod is loaded. +We will create a recipe that creates minecart with copper if the minecart improvements experiment is enabled.
- +
-First, we must use modLocalRuntime and modCompileOnly on any version of Farmer's Delight Refabricated,which can be taken from Modrinth's maven.+
  
 Next, we can go into our recipe provider and begin. Next, we can go into our recipe provider and begin.
Line 229: Line 227:
  @Override  @Override
  public void buildRecipes() {  public void buildRecipes() {
- shaped(RecipeCategory.FOOD, Items.EGG+ shaped(RecipeCategory.MISC, Items.MINECART
- .pattern("b") + .pattern("c c") 
- .pattern("w") + .pattern("ccc") 
- .define('b', ModItems.FRIED_EGG ) + .define('c', Items.COPPER_INGOT
- .define('w', Items.WATER_BUCKET+ .unlockedBy(getHasName(Items.COPPER_INGOT), has(Items.COPPER_INGOT)) 
- .unlockedBy(getHasName(ModItems.FRIED_EGG ), has(ModItems.FRIED_EGG )) + .save(withConditions(output, new FeaturesEnabledResourceCondition(Identifier.withDefaultNamespace("minecart_improvements");
- .save(withConditions(output, new AllModsLoadedResourceCondition(List.of("farmersdelight"))));+
  };  };
  }  }
Line 246: Line 243:
   "fabric:load_conditions": [   "fabric:load_conditions": [
     {     {
-      "condition": "fabric:all_mods_loaded", +      "condition": "fabric:features_enabled", 
-      "values": [ +      "features": [ 
-        "farmersdelight+        "minecraft:minecart_improvements
-      ]+      ] 
     }     }
   ],   ],
   "type": "minecraft:crafting_shaped",   "type": "minecraft:crafting_shaped",
-  "category": "food",+  "category": "misc",
   "key": {   "key": {
-    "b": "farmersdelight:fried_egg", +    "c": "minecraft:copper_ingot",
-    "w": "minecraft:water_bucket"+
   },   },
   "pattern": [   "pattern": [
-    "b", +    "c c", 
-    "w"+    "ccc"
   ],   ],
   "result": {   "result": {
     "count": 1,     "count": 1,
-    "id": "minecraft:egg"+    "id": "minecraft:minecart"
   }   }
 } }
drafts/resourceconditions.txt · Last modified: 2026/03/20 17:27 by infinitychances