14
edits
CreativeMD (talk | contribs) No edit summary |
m (Grammar and stuff) |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__FORCETOC__ | __FORCETOC__ | ||
Before you | Before creating recipes, we suggest you read [[Basic Item]] first in order to understand this tutorial. | ||
== Basics == | == Basics == | ||
Let's create | Let's create a recipe for our wand, which we added in [[Basic Item|basic items]] tutorial. | ||
=== Ingredient Pattern === | === Ingredient Pattern === | ||
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 | |||
[[File:Recipe Wand Pickaxe.png]] | [[File:Recipe Wand Pickaxe.png]] | ||
Line 19: | Line 19: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<code>P</code> and <code>S</code> are | <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. | ||
=== Ingredients === | === Ingredients === | ||
All we need to do now | 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. | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
"P": { type: "item", code: "pickaxe-copper"}, | "P": { type: "item", code: "game:pickaxe-copper"}, | ||
"S": { type: "item", code: "stick"} | "S": { type: "item", code: "game:stick"} | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<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. | ||
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. | |||
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: | ||
Line 43: | Line 45: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
"P": { type: "item", code: "pickaxe-copper"}, | "P": { type: "item", code: "game:pickaxe-copper"}, | ||
"S": { type: "item", code: "stick", quantity: 2} | "S": { type: "item", code: "game:stick", quantity: 2} | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 52: | Line 54: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
ingredients: { | ingredients: { | ||
"P": { type: "item", code: "pickaxe-copper", isTool: true}, | "P": { type: "item", code: "game:pickaxe-copper", isTool: true}, | ||
"S": { type: "item", code: "stick"} | "S": { type: "item", code: "game:stick"} | ||
}, | }, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 66: | Line 68: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
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 === | ||
This is | This is what our final recipe looks like: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 78: | Line 80: | ||
height: 3, | height: 3, | ||
ingredients: { | ingredients: { | ||
"P": { type: "item", code: "pickaxe-copper"}, | "P": { type: "item", code: "game:pickaxe-copper"}, | ||
"S": { type: "item", code: "stick"} | "S": { type: "item", code: "game:stick"} | ||
}, | }, | ||
output: { type: "item", code: "wand-pickaxe"} | output: { type: "item", code: "wand-pickaxe"} | ||
Line 85: | Line 87: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can download | 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 [http://wiki.vintagestory.at/images/8/87/MyWandRecipeMod.zip here]. | |||
== Advanced == | == Advanced == | ||
Line 96: | Line 100: | ||
ingredientPattern: "L", | ingredientPattern: "L", | ||
ingredients: { | ingredients: { | ||
"L": { type: "block", code: "log-*-ud", name: "wood" } | "L": { type: "block", code: "game:log-*-ud", name: "wood" } | ||
}, | }, | ||
width: 1, | width: 1, | ||
Line 107: | Line 111: | ||
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>. | ||
{{Navbox/modding|Vintage Story}} |
edits