mineflayer-collectblock icon indicating copy to clipboard operation
mineflayer-collectblock copied to clipboard

Bot unable to break block 2 blocks above its head

Open octo-kumo opened this issue 4 years ago • 5 comments

In this scenario, the bot is trying to chop trees, and it will get stuck on the block 2 blocks above its head. I have checked the logs, the block the bot is looking at (and feed into collect block) is the correct block.

  • version: 1.12.2 (no questioning why I'm still on 1.12)

code:

collect(accepts: number[]): Promise<any> | boolean {
    if (limit < 1) return false;
    const target = this.bot.findBlock({
        matching: accepts,
        maxDistance: 64
    });
    if (target) {
        this.log('collecting', target.name, target.position.toString());
        return new Promise((resolve, reject) => this.bot.collectBlock.collect(target, (err) => {
            if (err) reject(err);
            else resolve(target);
        }));
    } else return false;
}

plz support promises thks Screenshot 2021-01-10 at 6 23 30 PM

octo-kumo avatar Jan 10 '21 09:01 octo-kumo

Is there any error printed to the console?

Is the callback called?

Can you confirm the bot has permission to break the block? (I.e. not in spawn protection)

TheDudeFromCI avatar Jan 12 '21 13:01 TheDudeFromCI

There are no errors and the callback was never called, since behind this function is a infinite recursion, if it returned it would call the same function again. I will need to test with a barebones one later.

octo-kumo avatar Jan 12 '21 23:01 octo-kumo

Spawn protection is not a problem since the bot was able to break the bottom logs

octo-kumo avatar Jan 12 '21 23:01 octo-kumo

Doesnt seem to work in 1.16.1 either

octo-kumo avatar Jan 20 '21 23:01 octo-kumo

Same Problem for me

JohnGrubba avatar Aug 02 '21 09:08 JohnGrubba