MCPcopy
hub / github.com/PrismarineJS/mineflayer / craft

Function craft

lib/plugins/craft.js:11–34  ·  view source on GitHub ↗
(recipe, count, craftingTable)

Source from the content-addressed store, hash-verified

9 let windowCraftingTable
10
11 async function craft (recipe, count, craftingTable) {
12 assert.ok(recipe)
13 count = parseInt(count ?? 1, 10)
14 if (recipe.requiresTable && !craftingTable) {
15 throw new Error('Recipe requires craftingTable, but one was not supplied: ' + JSON.stringify(recipe))
16 }
17
18 try {
19 for (let i = 0; i < count; i++) {
20 await craftOnce(recipe, craftingTable)
21 }
22
23 if (windowCraftingTable) {
24 bot.closeWindow(windowCraftingTable)
25 windowCraftingTable = undefined
26 }
27 } catch (err) {
28 if (windowCraftingTable) {
29 bot.closeWindow(windowCraftingTable)
30 windowCraftingTable = undefined
31 }
32 throw new Error(err)
33 }
34 }
35
36 async function craftOnce (recipe, craftingTable) {
37 if (craftingTable) {

Callers

nothing calls this directly

Calls 1

craftOnceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…