Jump to content

Digital Crafter: Difference between revisions

From Advanced Computers Wiki
No edit summary
No edit summary
Line 21: Line 21:
!Description
!Description
|-
|-
| style="white-space: nowrap;" |<code>:searchRecipesWithIngredient(string"modname:itemname")</code>
| style="white-space: nowrap;" |<code>:searchRecipesWithIngredient(ingredient:string)</code>
|<code>recipe[]</code>
|<code>recipe[]</code>
|
|Returns all crafting recipes that use <code>ingredient</code> as an input. The ingredient needs to be in the format <code>modname:itemname</code>, e.g. <code>minecraft:stick</code>.
The result is a table of recipes, where each recipe is again a table that looks like the following:
<code>{ingredients={ {"minecraft:coal","minecraft:charCoal"},nil,nil,{"minecraft:stick"}, nil,nil,</code>
<code>nil,nil,nil},</code>
<code>result="minecraft:torch",</code>
<code>resultCount=4}</code>
|-
|-
| style="white-space: nowrap;" |<code>:searchRecipesWithResult(string"modname:itemname")</code>
| style="white-space: nowrap;" |<code>:searchRecipesWithResult(string"modname:itemname")</code>

Revision as of 15:35, 25 August 2026

This page describes unreleased, experimental content that is still in development which might undergo significant changes or be removed entirely.

Description

Provided component

This block provides the digitalCrafter component, offering the following properties:

DigitalCrafterUD component properties
Name Type Read/Write Description
cooldownRemaining number READ How much more time needs to pass before :craft may be called again.
DigitalCrafterUD component methods
Name Type Description
:searchRecipesWithIngredient(ingredient:string) recipe[] Returns all crafting recipes that use ingredient as an input. The ingredient needs to be in the format modname:itemname, e.g. minecraft:stick.

The result is a table of recipes, where each recipe is again a table that looks like the following: {ingredients={ {"minecraft:coal","minecraft:charCoal"},nil,nil,{"minecraft:stick"}, nil,nil, nil,nil,nil}, result="minecraft:torch", resultCount=4}

:searchRecipesWithResult(string"modname:itemname") recipe[]
:searchItemByName(string:partialName) string Returns the full name of the item
:craft(string"modname:itemname"[]:ingredients, string"modname:itemname":resultItem, int:amount, boolean:outputIntoOwnInventory) integer If all required items are available, crafts the result. If outputIntoOwnInventory is true the result is put into the own inventory. Otherwise it is pushed into the inventory that may be above, or it is ejected above in-world. Beware that there is no destination check to make sure that there is room in the inventory above, so items may spill if the destination is full.