Modding:Creating Recipes/ru: Difference between revisions
(change separator (tab to comma)) |
(Updating to match new version of source page) |
||
Line 1: | Line 1: | ||
<languages/> | |||
{{GameVersion|1.16}} | |||
Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять это руководство. | Прежде чем создавать рецепты, рекомендуем сначала прочитать [[Basic Item|Основа предмета]], чтобы понять это руководство. | ||
Line 4: | Line 6: | ||
== Основы == | == Основы == | ||
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве [[Basic Item|основа предмета]]. | <div class="mw-translate-fuzzy"> | ||
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве [[Basic Item|основа предмета]]. | |||
</div> | |||
=== Шаблон ингредиентов === | === Шаблон ингредиентов === | ||
Line 12: | Line 16: | ||
[[File:Recipe Wand Pickaxe.png]] | [[File:Recipe Wand Pickaxe.png]] | ||
<div class="mw-translate-fuzzy"> | |||
который будет выглядеть так: | который будет выглядеть так: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 18: | Line 23: | ||
height: 3, | height: 3, | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
<div class="mw-translate-fuzzy"> | |||
<code>P</code> и <code>S</code> являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием <code>_</code>. <code>Ширина</code> этого рецепта <code>1</code> и в нем <code>3</code> строки. Не ставьте пробелы между ячейками, например <code>_ P _</code> это 5, а не 3 ячейки. | <code>P</code> и <code>S</code> являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием <code>_</code>. <code>Ширина</code> этого рецепта <code>1</code> и в нем <code>3</code> строки. Не ставьте пробелы между ячейками, например <code>_ P _</code> это 5, а не 3 ячейки. | ||
</div> | |||
=== Ингредиенты === | === Ингредиенты === | ||
Line 74: | Line 82: | ||
Вот как выглядит наш последний рецепт: | Вот как выглядит наш последний рецепт: | ||
<div class="mw-translate-fuzzy"> | |||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
{ | { | ||
Line 86: | Line 95: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве <code>assets/myadvancedwand/recipes/grid/</code> и скопировать туда файлы. | Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве <code>assets/myadvancedwand/recipes/grid/</code> и скопировать туда файлы. | ||
<div class="mw-translate-fuzzy"> | |||
Вы можете скачать полный мод, включая предметы [[Media:MyWandRecipe.zip|здесь]]. | Вы можете скачать полный мод, включая предметы [[Media:MyWandRecipe.zip|здесь]]. | ||
</div> | |||
== Продвинутые рецепты == | == Продвинутые рецепты == | ||
Line 95: | Line 107: | ||
=== Типовые рецепты === | === Типовые рецепты === | ||
<div class="mw-translate-fuzzy"> | |||
Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен: | Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен: | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
Line 107: | Line 120: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</div> | |||
Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это <code>name: "wood"</code>), и все обозначенное <code>*</code>, позже будет заменено на выходе. Значение <code>{wood}</code> будет заменено типом используемого дерева. | Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это <code>name: "wood"</code>), и все обозначенное <code>*</code>, позже будет заменено на выходе. Значение <code>{wood}</code> будет заменено типом используемого дерева. | ||
<div class="mw-translate-fuzzy"> | |||
Например, если бы у нас был блок бревна березы, его код был бы <code>log-birch-ud</code>, поэтому <code>*</code> будет означать <code>birch</code>, поэтому выходные данные будут преобразованы из <code>code: "planks-{wood}"</code> в <code>code: "planks-birch"</code>. | Например, если бы у нас был блок бревна березы, его код был бы <code>log-birch-ud</code>, поэтому <code>*</code> будет означать <code>birch</code>, поэтому выходные данные будут преобразованы из <code>code: "planks-{wood}"</code> в <code>code: "planks-birch"</code>. | ||
</div> | |||
<div class="mw-translate-fuzzy"> | |||
{{Navbox/modding|Vintage Story}} | |||
</div> | |||
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"> | |||
{ | |||
ingredientPattern: "SBS,_L_", | |||
ingredients: { | |||
"L": { type: "block", code: "linen-*" }, | |||
"S": { type: "item", code: "powderedsulfur" }, | |||
"B": { | |||
type: "block", | |||
code: "bowl-honey", | |||
returnedStack: { type: "block", code: "bowl-burned" } | |||
} | |||
}, | |||
width: 3, | |||
height: 2, | |||
output: { type: "item", code: "poultice-linen-honey-sulfur", quantity: 4 } | |||
} | |||
</syntaxhighlight> | |||
=== Consuming more than one durability per tool === | |||
To balance durability consuming, it can be done by adding <code>toolDurabilityCost</code> and <code>isTool</code>. This is recipe for pulverizer pounder: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "HL_,CL_,_L_", | |||
ingredients: { | |||
"H": { type: "item", code: "hammer-*", isTool: true, toolDurabilityCost: 10 }, | |||
"C": { type: "item", code: "chisel-*", isTool: true, toolDurabilityCost: 10 }, | |||
"L": { type: "block", code: "log-placed-*-ud", name: "wood" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
output: { type: "item", code: "pounder-oak", quantity: 1 } | |||
} | |||
</syntaxhighlight> | |||
=== Separating recipes on the same handbook page === | |||
Sometimes amount of recipes for one item can become overwhelming, to separate important ones, it can be done by adding <code>recipeGroup</code>. These are recipes for wooden ladder: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "S_S,SSS,S_S", | |||
ingredients: { | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
recipeGroup: 1, | |||
output: { type: "block", code: "ladder-wood-north", quantity: 3 } | |||
}, | |||
{ | |||
ingredientPattern: "P_P,PSP,P_P", | |||
ingredients: { | |||
"P": { type: "item", code: "plank-*" }, | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 3, | |||
output: { type: "block", code: "ladder-wood-north", quantity: 3 } | |||
} | |||
</syntaxhighlight> | |||
=== Restricting to a specific class === | |||
The recipe can be limited to a specific [[Classes|class]]. This can be done by adding <code>requiresTrait</code>. This is recipe for sewing kit: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "FFS,FF_", | |||
requiresTrait: "clothier", | |||
ingredients: { | |||
"F": { type: "item", code: "flaxtwine" }, | |||
"S": { type: "item", code: "stick" } | |||
}, | |||
width: 3, | |||
height: 2, | |||
output: { type: "item", code: "sewingkit" } | |||
} | |||
</syntaxhighlight> | |||
=== Copying attributes === | |||
Some recipes can require to copy attributes. This is can be done by adding <code>copyAttributesFrom</code>. This is recipe for labeled crate: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
ingredientPattern: "S,C", | |||
ingredients: { | |||
"S": { type: "item", code: "paper-parchment" }, | |||
"C": { type: "block", code: "crate" } | |||
}, | |||
shapeless: true, | |||
copyAttributesFrom: 'C', | |||
width: 1, | |||
height: 2, | |||
output: { type: "block", code: "crate", attributes: { label: "paper-empty" } } | |||
} | |||
</syntaxhighlight> | |||
{{Navbox/modding|Vintage Story}} | {{Navbox/modding|Vintage Story}} |
Revision as of 05:53, 14 June 2022
Эта страница проверялась в последний раз для версии Vintage Story 1.16.
Прежде чем создавать рецепты, рекомендуем сначала прочитать Основа предмета, чтобы понять это руководство.
Основы
Давайте создадим рецепт для нашей палочки, который мы добавили в руководстве основа предмета.
Шаблон ингредиентов
Давайте начнем с объявления шаблона или макета рецепта, в нашем примере мы хотим, чтобы игрок поместил кирку поверх двух палочек.
который будет выглядеть так:
ingredientPattern: "P,S,S",
width: 1,
height: 3,
P
и S
являются идентификаторами, которые будут определены позже. Каждая строка разделена запятой, а пустая ячейка помечена подчеркиванием _
. Ширина
этого рецепта 1
и в нем 3
строки. Не ставьте пробелы между ячейками, например _ P _
это 5, а не 3 ячейки.
Ингредиенты
Все, что нам нужно сделать сейчас, это определить идентификаторы, которые мы использовали ранее. В нашем примере P
обозначает медную кирку, а S
- обычную палку.
ingredients: {
"P": { type: "item", code: "game:pickaxe-copper"},
"S": { type: "item", code: "game:stick"}
},
Type
является либо block
, либо item
, в зависимости от того, является ли он предметом или блоком.
Когда в рецептах есть ванильные предметы, им нужно game:
перед названием предмета. Когда они из вашего собственного мода, вы можете просто поставить название предмета.
Чтобы узнать code
каждого предмета (или блока), вы можете ввести .edi
в консоль, которая добавит свойство code в всплывающую подсказку:
Кроме того, мы могли бы добавить необходимое количество к нашим ингредиентам, поэтому вместо одной палки на слот мы могли бы потребовать больше:
ingredients: {
"P": { type: "item", code: "game:pickaxe-copper"},
"S": { type: "item", code: "game:stick", quantity: 2}
},
Еще одна вещь, которую мы могли бы сделать - вместо того, чтобы потреблять кирку, мы могли бы использовать ее как инструмент:
ingredients: {
"P": { type: "item", code: "game:pickaxe-copper", isTool: true},
"S": { type: "item", code: "game:stick"}
},
Это может привести к тому, что кирка потеряет одну прочность во время крафта, вместо того, чтобы потреблять всю кирку сразу.
Возврат (выход)
Нам все еще нужно определить результат, который довольно похож на определение ингредиентов:
output: { type: "item", code: "wand-pickaxe"}
Теоретически, мы могли бы также добавить свойство quantity
(количество) здесь.
Распространение
Вот как выглядит наш последний рецепт:
{
ingredientPattern: "P,S,S",
width: 1,
height: 3,
ingredients: {
"P": { type: "item", code: "game:pickaxe-copper"},
"S": { type: "item", code: "game:stick"}
},
output: { type: "item", code: "wand-pickaxe"}
}
Чтобы добавить эти рецепты для крафта в ваш мод, вам нужно создать еще одну папку в вашем рабочем пространстве assets/myadvancedwand/recipes/grid/
и скопировать туда файлы.
Вы можете скачать полный мод, включая предметы здесь.
Продвинутые рецепты
Типовые рецепты
Есть более сложные вещи, которые вы можете сделать с рецептами. Это рецепт для деревянных досок, которые сделаны из бревен:
{
ingredientPattern: "L",
ingredients: {
"L": { type: "block", code: "game:log-*-ud", name: "wood" }
},
width: 1,
height: 1,
output: { type: "block", code: "planks-{wood}", quantity: 4 }
}
Вместо того, чтобы иметь рецепт для каждого типа древесины, вы можете назначить имя ингредиенту (в данном случае это name: "wood"
), и все обозначенное *
, позже будет заменено на выходе. Значение {wood}
будет заменено типом используемого дерева.
Например, если бы у нас был блок бревна березы, его код был бы log-birch-ud
, поэтому *
будет означать birch
, поэтому выходные данные будут преобразованы из code: "planks-{wood}"
в code: "planks-birch"
.
Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.
Modding | |
---|---|
Modding Introduction | Getting Started • Пакет тем |
Content Modding | Content Mods • Developing a Content Mod • Basic Tutorials • Intermediate Tutorials • Advanced Tutorials • Content Mod Concepts |
Code Modding | Code Mods • Setting up your Development Environment |
Property Overview | Item • Entity • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |
Continuing with the honey-sulfur poultice example, a bowl of honey as an ingredient looks like "B": { type: "block", code: "bowl-honey" }
, but the player would lose the bowl if the recipe were written this way. We need to add returnedStack
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 returnedStack: { type: "block", code: "bowl-burned" }
. This property is placed alongside the type
and code
properties of an ingredient. Putting it all together:
{
ingredientPattern: "SBS,_L_",
ingredients: {
"L": { type: "block", code: "linen-*" },
"S": { type: "item", code: "powderedsulfur" },
"B": {
type: "block",
code: "bowl-honey",
returnedStack: { type: "block", code: "bowl-burned" }
}
},
width: 3,
height: 2,
output: { type: "item", code: "poultice-linen-honey-sulfur", quantity: 4 }
}
Consuming more than one durability per tool
To balance durability consuming, it can be done by adding toolDurabilityCost
and isTool
. This is recipe for pulverizer pounder:
{
ingredientPattern: "HL_,CL_,_L_",
ingredients: {
"H": { type: "item", code: "hammer-*", isTool: true, toolDurabilityCost: 10 },
"C": { type: "item", code: "chisel-*", isTool: true, toolDurabilityCost: 10 },
"L": { type: "block", code: "log-placed-*-ud", name: "wood" }
},
width: 3,
height: 3,
output: { type: "item", code: "pounder-oak", quantity: 1 }
}
Separating recipes on the same handbook page
Sometimes amount of recipes for one item can become overwhelming, to separate important ones, it can be done by adding recipeGroup
. These are recipes for wooden ladder:
{
ingredientPattern: "S_S,SSS,S_S",
ingredients: {
"S": { type: "item", code: "stick" }
},
width: 3,
height: 3,
recipeGroup: 1,
output: { type: "block", code: "ladder-wood-north", quantity: 3 }
},
{
ingredientPattern: "P_P,PSP,P_P",
ingredients: {
"P": { type: "item", code: "plank-*" },
"S": { type: "item", code: "stick" }
},
width: 3,
height: 3,
output: { type: "block", code: "ladder-wood-north", quantity: 3 }
}
Restricting to a specific class
The recipe can be limited to a specific class. This can be done by adding requiresTrait
. This is recipe for sewing kit:
{
ingredientPattern: "FFS,FF_",
requiresTrait: "clothier",
ingredients: {
"F": { type: "item", code: "flaxtwine" },
"S": { type: "item", code: "stick" }
},
width: 3,
height: 2,
output: { type: "item", code: "sewingkit" }
}
Copying attributes
Some recipes can require to copy attributes. This is can be done by adding copyAttributesFrom
. This is recipe for labeled crate:
{
ingredientPattern: "S,C",
ingredients: {
"S": { type: "item", code: "paper-parchment" },
"C": { type: "block", code: "crate" }
},
shapeless: true,
copyAttributesFrom: 'C',
width: 1,
height: 2,
output: { type: "block", code: "crate", attributes: { label: "paper-empty" } }
}
Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.
Modding | |
---|---|
Modding Introduction | Getting Started • Пакет тем |
Content Modding | Content Mods • Developing a Content Mod • Basic Tutorials • Intermediate Tutorials • Advanced Tutorials • Content Mod Concepts |
Code Modding | Code Mods • Setting up your Development Environment |
Property Overview | Item • Entity • Block • Block Behaviors • Block Classes • Block Entities • Block Entity Behaviors • World properties |
Workflows & Infrastructure | Modding Efficiency Tips • Mod-engine compatibility • Mod Extensibility • VS Engine |
Additional Resources | Community Resources • Modding API Updates • Programming Languages • List of server commands • List of client commands • Client startup parameters • Server startup parameters Example Mods • API Docs • GitHub Repository |