component CraftRecipe#
Hierarchy#
Valid Parent Blocks:
Required Child Blocks:
Possible Child Blocks:
ID Properties#
This block should not have an ID.
Parameters#
category#
(see category)
- Type:
string
- Default:
Miscellaneous
The category under which the recipe will be listed in the crafting menu. Helps to organize and identify recipes in crafting menu. Currently doesn’t support translations (confirmed last 42.19.0).
NeedToBeLearn#
(see NeedToBeLearn)
- Type:
Any
Whether the recipe needs to be learned before it can be crafted.
OnCreate#
(see OnCreate)
- Type:
callback
Various callback functions can be added to a recipe to trigger at specific moments during the crafting process:
OnCreate is called when the crafting recipe is finished.
OnTest is called to verify if the item can be used in the recipe.
OnFailed is called when the crafting recipe fails or is canceled.
OnUpdate is called every tick while the recipe is being crafted.
The callback needs to be a Lua function defined as a global function#Local_and_global), which can also be stored in a global table. The vanilla game OnCreate’s are stored in the Java.
For example, for OnCreate you should have the following structure:
---@param craftRecipeData CraftRecipeData
---@param character IsoGameCharacter
function MyOnCreateFunction(craftRecipeData, character)
-- your custom code here
end
The craftRecipeData is a java object that contains the data of the crafting recipe. The character is the player character who is crafting the recipe.
For OnTest you should have the following structure:
---@param item InventoryItem
---@param character IsoGameCharacter
---@return boolean logicTestResult
function MyOnTestFunction(item, character)
-- your custom code here
return logicTestResult -- based on your logic test above
end
SkillRequired#
(see SkillRequired)
- Type:
object (object: string->>integer, kv: ‘:’, pairs: ‘;’)
Specifies the skill level required to perform this crafting action. It should be formatted this way:
/* a single skill */
skillRequired = <skill name>:<level>,
/* multiple skills */
skillRequired = <skill1 name>:<level>;<skill2 name>:<level>,
For the list of available skills, see the wiki.
For example:
skillRequired = Blacksmith:3;Tailoring:2,
time#
(see time)
- Type:
integer
- Default:
50
The time it takes to craft the item, not using a specific unit of time so refer to the vanilla recipes to get an idea of what value to use.
timedAction#
(see timedAction)
- Type:
block (block: timedAction)
Refers to a timed action script block to trigger during the crafting process, for animations and/or sounds but also the calories burned and body heat generation.
Tooltip#
(see Tooltip)
- Type:
string
Description of the crafting which is shown in the crafting menu. The value needs be a key in the Tooltip.json translation file. For example:
Tooltip = MyTooltipKey,
And in the translation file: ```json {
“MyTooltipKey”: “This is my tooltip description.”
}
xpAward#
(see xpAward)
- Type:
Any
Specifies the experience points awarded for crafting this item. The parameter should be formatted this way:
/* a single skill */
xpAward = <skill name>:<xp amount>,
/* multiple skills */
xpAward = <skill1 name>:<xp amount>;<skill2 name>:<xp amount>,format
For the list of available skills, see the wiki.
For example:
xpAward = Blacksmith:10;Tailoring:5,