turtle.craft
Requires the turtle to have a crafting table equipped.
turtle.craft Function | |
---|---|
Syntax turtle.craft(
| |
Returns | boolean true | boolean false, string |
API | turtle |
Source | CC:Tweaked (source) |
Crafts items if the turtle's inventory contains a valid recipe and nothing else. It is not limited to the top-left nine slots - as long as its inventory contains the necessary pattern of items and is free of any other items (including ones outside of the space the crafting pattern occupies), it can craft. Produced items will fill the selected slot preferentially and the ones after it if it is full. It is not limited to crafting a single stack at once - for example, if you put a stack of redstone blocks in a turtle and execute this, nine stacks of redstone will be produced.
The argument "limit" limits the amount of times the crafting recipe will be made. If enough items to make it multiple times are provided, but a limit lower than this is specified, it will make the recipe the specified amount of times and leave the remaining items in their places. If "limit" is 0, it will return true
if an item could be crafted.
The first return value represents whether crafting was successful or not. If an error occurs it will be false
and the second return value will contain the error message. For example, if the turtle does not contain a valid recipe when this is executed, it will return false
and "No matching recipes"
. If crafting is successful it will return only true
.