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

Function extendWindow

lib/plugins/inventory.js:346–383  ·  view source on GitHub ↗
(window)

Source from the content-addressed store, hash-verified

344 }
345
346 function extendWindow (window) {
347 window.close = () => {
348 closeWindow(window)
349 window.emit('close')
350 }
351
352 window.withdraw = async (itemType, metadata, count, nbt) => {
353 if (bot.inventory.emptySlotCount() === 0) {
354 throw new Error('Unable to withdraw, Bot inventory is full.')
355 }
356 const options = {
357 window,
358 itemType,
359 metadata,
360 count,
361 nbt,
362 sourceStart: 0,
363 sourceEnd: window.inventoryStart,
364 destStart: window.inventoryStart,
365 destEnd: window.inventoryEnd
366 }
367 await transfer(options)
368 }
369 window.deposit = async (itemType, metadata, count, nbt) => {
370 const options = {
371 window,
372 itemType,
373 metadata,
374 count,
375 nbt,
376 sourceStart: window.inventoryStart,
377 sourceEnd: window.inventoryEnd,
378 destStart: 0,
379 destEnd: window.inventoryStart
380 }
381 await transfer(options)
382 }
383 }
384
385 async function openBlock (block, direction, cursorPos) {
386 bot.activateBlock(block, direction, cursorPos)

Callers 3

openBlockFunction · 0.85
openEntityFunction · 0.85
prepareWindowFunction · 0.85

Calls 2

closeWindowFunction · 0.85
transferFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…