|
|
|
|
|
|
|
|
async function getItemFromChest(bot, chestPosition, itemsToGet) { |
|
|
await moveToChest(bot, chestPosition); |
|
|
const chestBlock = bot.blockAt(chestPosition); |
|
|
const chest = await bot.openContainer(chestBlock); |
|
|
for (const name in itemsToGet) { |
|
|
const itemByName = mcData.itemsByName[name]; |
|
|
const item = chest.findContainerItem(itemByName.id); |
|
|
await chest.withdraw(item.type, null, itemsToGet[name]); |
|
|
} |
|
|
await closeChest(bot, chestBlock); |
|
|
} |
|
|
|
|
|
|
|
|
async function depositItemIntoChest(bot, chestPosition, itemsToDeposit) { |
|
|
await moveToChest(bot, chestPosition); |
|
|
const chestBlock = bot.blockAt(chestPosition); |
|
|
const chest = await bot.openContainer(chestBlock); |
|
|
for (const name in itemsToDeposit) { |
|
|
const itemByName = mcData.itemsByName[name]; |
|
|
const item = bot.inventory.findInventoryItem(itemByName.id); |
|
|
await chest.deposit(item.type, null, itemsToDeposit[name]); |
|
|
} |
|
|
await closeChest(bot, chestBlock); |
|
|
} |
|
|
|
|
|
|
|
|
async function checkItemInsideChest(bot, chestPosition) { |
|
|
await moveToChest(bot, chestPosition); |
|
|
const chestBlock = bot.blockAt(chestPosition); |
|
|
await bot.openContainer(chestBlock); |
|
|
|
|
|
await closeChest(bot, chestBlock); |
|
|
} |
|
|
|