PrismarineJS / mineflayer-collectblock

A simple utility plugin for Mineflayer that add a higher level API for collecting blocks.
MIT License
39 stars 25 forks source link

Bot doesn't check whether it can reach the block #109

Open depthso opened 2 years ago

depthso commented 2 years ago

I am creating a bot that can find a tree and mine/collect its wood but when there is a tall tree, the bot looks up and mines nothing and doesn't even bother to mine/dig blocks in front of it that obscures it.

Bot does mine blocks that are in front of it, e.g on the right or left, but doesn't when the block is upwards

const blocks = bot.findBlocks({
        matching: MinecraftData.blocksByName.oak_log.id,
        maxDistance: 64,
        count: Amount
})

if (blocks.length === 0) {
        console.log("No blocks found")
        await LookAround()
        GetWood2()
        return
}

console.log("Found Wood")

const targets = []
for (let i = 0; i < Math.min(blocks.length, Amount); i++) {
  targets.push(bot.blockAt(blocks[i]))
 }

try {
        await bot.collectBlock.collect(targets)
} catch (err) {
        console.log(err)
}

image