SketchySpaghetti Posted February 12, 2025 Report Posted February 12, 2025 (edited) Im struggling at the moment to understand how varients work. I'm currently working on a patch for Expanded Foods and The Art of Growing. I've managed to create varient items for each different catagory of wildness from The Art of Growing for Expanded Foods, but trying to implement them into recipes has been a headach. I'm very new to vintage story and it's moding scene but I'm currently studying programming so i have some background there, but I can't for the life of me figure it out. To give some context, the wiki says this on Varient-Based Recipes: Spoiler Variant-Based Recipes The code that is given within the recipe file works to create an oak sleek door from an oak solid door. However, there exists a sleek door for every solid door, so let's go ahead and create 13 or so other recipes for the other wood types. Of course, there's a much easier way of doing that, and it uses the variant system. Firstly, let's add a wildcard into out ingredient's code to allow us to use a solid door of any type. "D": { "type": "block", "code": "game:door-solid-*" } So, the recipe now inputs any type of solid door, but will always return an oak sleek door. There needs to be a way of copying the text from the wildcard ( * ) and using it within the output. By using the "name" property in the ingredient, you can achieve exactly that. "D": { "type": "block", "code": "game:door-solid-*", "name": "wood" } This now marks the recipe as containing a variant called "wood". Note that this name can be anything, it does not have to match with the variant code used when the item or block was defined. To use this in the output, you can use a variant substitution ({ }) in the output code. "output": { "type": "block", "code": "game:door-sleek-windowed-{wood}" } Make sure that you use the variant code you defined earlier (using "name") is the same as the substitution in your output. Important: You cannot name more than one variant per ingredient. If you test your recipe now, you'll find that you can create any sleek door from its appropriate solid door type. Following those instructions I have managed to create this so far: Spoiler [ { "ingredientPattern": "KV", "recipeGroup": 1, "ingredients": { "K": { "type": "item", "code": "game:knife-*", "isTool": true }, "V": { "type": "item", "code": "artofgrowing:vegetable-small-*", "allowedVariants": [ "carrot", "cabbage", "onion", "turnip", "parsnip", "pickledcarrot", "pickledonion", "pickledturnip", "pickledparsnip" ], "name": "type" } }, "width": 2, "height": 1, "output": { "type": "item", "code": "artofgrowingchoppedvegetables-small-{type}", "quantity": 1 } } ] This recipes functions correctly but I would like to do something along the lines of this: Spoiler "variantgroups": [ { "code": "size", "states": [ "wild", "small", "medium", "decent", "large", "hefty", "gigantic" ] }, { "code": "type", "states": [ "carrot", "cabbage", "onion", "turnip", "parsnip", "pickledcarrot", "pickledonion", "pickledturnip", "pickledparsnip" ] } ], Which is a snippet from the code I used to create all the varients based off of The Art of Growing's system. Im hoping that someone can guide me or has a better understanding of the syntax used in the JSON files, I would like to not have to repeat the process for each varient as it would make the work far more time consuming. Im hoping to achieve something that looks like this: Spoiler [ { "ingredientPattern": "KV", "recipeGroup": 1, "ingredients": { "K": { "type": "item", "code": "game:knife-*", "isTool": true }, "V": { "type": "item", "code": "artofgrowing:vegetable-{size}-{type}", "allowedVariants": [ { "name": "size", [ "wild", "small", "medium", "decent", "large", "hefty", "gigantic" ] }, { "name": "type", [ "carrot", "cabbage", "onion", "turnip", "parsnip", "pickledcarrot", "pickledonion", "pickledturnip", "pickledparsnip" ] } ] } }, "width": 2, "height": 1, "output": { "type": "item", "code": "artofgrowingchoppedvegetables-{size}-{type}", "quantity": 1 } } ] Please if anyone knows of a way or can just better explain to me the syntax or what is allowed then I would greatly appreciate it Edited February 12, 2025 by SketchySpaghetti
Brady_The Posted February 12, 2025 Report Posted February 12, 2025 (edited) 12 minutes ago, SketchySpaghetti said: Please if anyone knows of a way or can just better explain to me the syntax or what is allowed then I would greatly appreciate it Unfortunately currently only one wildcard (character) per recipe ingredient is allowed. You'll have to create 7 different recipes to cater to all size variants. A tip: If you add Quote "shapeless": true to the recipe, you can put the ingredients anywhere in the grid without particular order. Edited February 12, 2025 by Brady_The 1
SketchySpaghetti Posted February 12, 2025 Author Report Posted February 12, 2025 Thank you, someone on the discord confirmed this as well. I will make them shapeless as that makes a whole lot more sense, i was bacing it off of the orignal mod which is Expanded Foods and using the same structure and style of patching so that i can submit it through github.
Recommended Posts