Digital Crafter: Difference between revisions
No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
The crafter also come with an inventory of 27 slots from which the ingredients are taken. Extra-results, such as empty buckets when crafting a cake, are returned into this inventory again. The desired output, e.g. the cake, is either pushed upwards (into a block with inventory or ejected), or alternatively returned into the own inventory, depending on the <code>outputIntoOwnInventory</code> argument. | The crafter also come with an inventory of 27 slots from which the ingredients are taken. Extra-results, such as empty buckets when crafting a cake, are returned into this inventory again. The desired output, e.g. the cake, is either pushed upwards (into a block with inventory or ejected), or alternatively returned into the own inventory, depending on the <code>outputIntoOwnInventory</code> argument. | ||
Every crafting operation is instant but may impose a delay that is computed as stated in the description of <code>baseCooldown</code>. The base cooldown of crafting operations is configurable in the mod config. | |||
Revision as of 16:28, 25 August 2026


A block that allows crafting any crafting recipes using a set of Lua functions. Also allows searching for items and looking up recipes by ingredient names or result names.
The crafter also come with an inventory of 27 slots from which the ingredients are taken. Extra-results, such as empty buckets when crafting a cake, are returned into this inventory again. The desired output, e.g. the cake, is either pushed upwards (into a block with inventory or ejected), or alternatively returned into the own inventory, depending on the outputIntoOwnInventory argument.
Every crafting operation is instant but may impose a delay that is computed as stated in the description of baseCooldown. The base cooldown of crafting operations is configurable in the mod config.
Provided component
This block provides the digitalCrafter component, offering the following properties:
| Name | Type | Read/Write | Description |
|---|---|---|---|
cooldownRemaining
|
number
|
READ | How much more time needs to pass before :craft may be called again.
|
baseCooldown
|
number
|
READ | The base cooldown after each :craft operation. The actual cooldown is given by .
|
| 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
}
ingredients entry represents a 3x3 grid, left to right, top to bottom.
|
:searchRecipesWithResult(result:string)
|
recipe[]
|
Returns all crafting recipes that produce the given item. |
:searchItemByName(string:partialName)
|
string
|
Returns all item names matching the given query string. |
:craft(ingredients:(string|nil)[], resultItem:string, 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.
Ingredients are supplied as a table of entries, similar to the ingredients field in recipes, but with a fixed value instead of a table in each slot. E.g. The recipe above can be supplied as Due to the possibility of |