435
edits
No edit summary |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> | |||
<translate> | |||
<!--T:1--> | |||
__FORCETOC__ | __FORCETOC__ | ||
Before creating recipes, we suggest you read [[Basic Item]] first in order to understand this tutorial. | Before creating recipes, we suggest you read [[Basic Item]] first in order to understand this tutorial. | ||
== Basics == | == Basics == <!--T:2--> | ||
<!--T:3--> | |||
Let's create a recipe for our wand, which we added in [[Basic Item|basic items]] tutorial. | Let's create a recipe for our wand, which we added in [[Basic Item|basic items]] tutorial. | ||
=== Ingredient Pattern === | === Ingredient Pattern === <!--T:4--> | ||
<!--T:5--> | |||
Let's begin by declaring the pattern or layout of the recipe, in our example we'll want the player to place a pickaxe on top of 2 sticks | Let's begin by declaring the pattern or layout of the recipe, in our example we'll want the player to place a pickaxe on top of 2 sticks | ||
<!--T:6--> | |||
[[File:Recipe Wand Pickaxe.png]] | [[File:Recipe Wand Pickaxe.png]] | ||
<!--T:7--> | |||
which would look like this: | which would look like this: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 19: | Line 27: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:8--> | |||
<code>P</code> and <code>S</code> are identifiers which will be defined later. Every row is separated with a tab, while an empty cell is marked with an underscore <code>_</code>. The <code>width</code> of this recipe is <code>1</code> and it is <code>3</code> rows high. Don't put spaces between the cells for example <code>_ P _</code> is 5 not 3 cells. | <code>P</code> and <code>S</code> are identifiers which will be defined later. Every row is separated with a tab, while an empty cell is marked with an underscore <code>_</code>. The <code>width</code> of this recipe is <code>1</code> and it is <code>3</code> rows high. Don't put spaces between the cells for example <code>_ P _</code> is 5 not 3 cells. | ||
=== Ingredients === | === Ingredients === <!--T:9--> | ||
<!--T:10--> | |||
All we need to do now is to define the identifiers we have used before. In our example <code>P</code> stands for a copper pickaxe and <code>S</code> for an ordinary stick. | All we need to do now is to define the identifiers we have used before. In our example <code>P</code> stands for a copper pickaxe and <code>S</code> for an ordinary stick. | ||
<!--T:11--> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
Line 32: | Line 43: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:12--> | |||
<code>Type</code> is either <code>block</code> or <code>item</code> depending whether it's an item or a block. | <code>Type</code> is either <code>block</code> or <code>item</code> depending whether it's an item or a block. | ||
<!--T:13--> | |||
When recipes have vanilla items they need <code>game:</code> in front of the item name. When they are from your own mod you can just put the item name. | When recipes have vanilla items they need <code>game:</code> in front of the item name. When they are from your own mod you can just put the item name. | ||
<!--T:14--> | |||
In order to find out the <code>code</code> of each item (or block), you can type <code>.edi</code> into console, which will add the code property to the tooltip: | In order to find out the <code>code</code> of each item (or block), you can type <code>.edi</code> into console, which will add the code property to the tooltip: | ||
<!--T:15--> | |||
[[File:Recipe Stick Tooltip.png]] | [[File:Recipe Stick Tooltip.png]] | ||
<!--T:16--> | |||
Furthermore, we could add a required quantity to our ingredients, so instead of one stick per slot we could make it require more: | Furthermore, we could add a required quantity to our ingredients, so instead of one stick per slot we could make it require more: | ||
<!--T:17--> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
Line 50: | Line 67: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:18--> | |||
Another thing we could do is instead of consuming the pickaxe, we could use it as a tool: | Another thing we could do is instead of consuming the pickaxe, we could use it as a tool: | ||
<!--T:19--> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
Line 59: | Line 78: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:20--> | |||
This would cause the pickaxe to lose one durability during crafting, instead of consuming the whole pickaxe at once. | This would cause the pickaxe to lose one durability during crafting, instead of consuming the whole pickaxe at once. | ||
=== Output === | === Output === <!--T:21--> | ||
<!--T:22--> | |||
We still need to define the output, which is rather similar to defining the ingredients: | We still need to define the output, which is rather similar to defining the ingredients: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 68: | Line 89: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:23--> | |||
Theoretically, we could add the <code>quantity</code> property here as well. | Theoretically, we could add the <code>quantity</code> property here as well. | ||
=== Distributing === | === Distributing === <!--T:24--> | ||
<!--T:25--> | |||
This is what our final recipe looks like: | This is what our final recipe looks like: | ||
<!--T:26--> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
Line 87: | Line 111: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:27--> | |||
In order to add those crafting recipes to your mod, you have to create another folder in your workspace <code>assets/myadvancedwand/recipes/grid/</code> and copy the files in there. | In order to add those crafting recipes to your mod, you have to create another folder in your workspace <code>assets/myadvancedwand/recipes/grid/</code> and copy the files in there. | ||
You can download the full mod including the items [ | <!--T:28--> | ||
You can download the full mod including the items [[Media:MyWandRecipe.zip|here]]. | |||
== Advanced == | == Advanced == <!--T:29--> | ||
=== Type based recipes === | === Type based recipes === <!--T:30--> | ||
<!--T:31--> | |||
There are more complicated things you can do with recipes. This the recipe for wooden planks which are crafted out of logs: | There are more complicated things you can do with recipes. This the recipe for wooden planks which are crafted out of logs: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 108: | Line 135: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<!--T:32--> | |||
Instead of having a recipe for every wood type, you can assign a name to an ingredient (in this case it is <code>name: "wood"</code>) and everything identified by <code>*</code> will later on replaced be for the output. Meaning <code>{wood}</code> will be replaced by the type of the giving log. | Instead of having a recipe for every wood type, you can assign a name to an ingredient (in this case it is <code>name: "wood"</code>) and everything identified by <code>*</code> will later on replaced be for the output. Meaning <code>{wood}</code> will be replaced by the type of the giving log. | ||
<!--T:33--> | |||
For example if we would have a birch log block, its code would be <code>log-birch-ud</code>, so <code>*</code> would stand for <code>birch</code>, therefore the output will be converted from <code>code: "planks-{wood}"</code> to <code>code: "planks-birch"</code>. | For example if we would have a birch log block, its code would be <code>log-birch-ud</code>, so <code>*</code> would stand for <code>birch</code>, therefore the output will be converted from <code>code: "planks-{wood}"</code> to <code>code: "planks-birch"</code>. | ||
<!--T:34--> | |||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} | ||
</translate> |
edits