Modding:Creating Recipes: Difference between revisions

From Vintage Story Wiki
m (Space -> comma too)
(Marked this version for translation)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>
<!--T:40-->
{{GameVersion|1.16}}
{{GameVersion|1.16}}


Line 145: Line 146:
Sometimes you want to keep one or more of the ingredients, but convert them to a different item after crafting. For example, when crafting a honey-sulfur poultice, the player needs a bowl filled with honey, but the bowl is not consumed to craft it. Instead the bowl of honey is turned into an empty bowl. This is accomplished by adding the <code>returnedStack</code> property to the ingredient. This property's value needs to contain a <code>type</code> and <code>code</code> just like the standard ingredient properties. This tells the recipe which item to give the player back.
Sometimes you want to keep one or more of the ingredients, but convert them to a different item after crafting. For example, when crafting a honey-sulfur poultice, the player needs a bowl filled with honey, but the bowl is not consumed to craft it. Instead the bowl of honey is turned into an empty bowl. This is accomplished by adding the <code>returnedStack</code> property to the ingredient. This property's value needs to contain a <code>type</code> and <code>code</code> just like the standard ingredient properties. This tells the recipe which item to give the player back.


<!--T:41-->
Continuing with the honey-sulfur poultice example, a bowl of honey as an ingredient looks like <code>"B": { type: "block", code: "bowl-honey" }</code>, but the player would lose the bowl if the recipe were written this way. We need to add <code>returnedStack</code> to the ingredient's properties and indicate which item to replace it with. In this case, the player should receive an empty bowl in place of the bowl of honey <code>returnedStack: { type: "block", code: "bowl-burned" }</code>. This property is placed alongside the <code>type</code> and <code>code</code> properties of an ingredient. Putting it all together:
Continuing with the honey-sulfur poultice example, a bowl of honey as an ingredient looks like <code>"B": { type: "block", code: "bowl-honey" }</code>, but the player would lose the bowl if the recipe were written this way. We need to add <code>returnedStack</code> to the ingredient's properties and indicate which item to replace it with. In this case, the player should receive an empty bowl in place of the bowl of honey <code>returnedStack: { type: "block", code: "bowl-burned" }</code>. This property is placed alongside the <code>type</code> and <code>code</code> properties of an ingredient. Putting it all together:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">