PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 904 forks source link

Unable to dismount - Error: dismount: not mounted #3119

Closed MikeSimpson closed 1 year ago

MikeSimpson commented 1 year ago

Versions

Detailed description of a problem

When attempting to dismount a boat I get the following error. The player is on the boat as viewed in minecraft. Error: dismount: not mounted at EventEmitter.dismount (/Users/mike/Documents/MC/node_modules/mineflayer/lib/plugins/entities.js:694:25)

What did you try yet?

I have tried making the robot manually sneak as a fallback but that doesn't work either

Your current code


 bot.dismount();

Expected behavior

Robot should dismount

PondWader commented 1 year ago

What are you doing to mount the bot on the boat, could you provide some code? It's working fine for me.

bot.on('chat', (_, msg) => {
    if (msg === '.mount') {
        bot.mount(bot.nearestEntity(e => e.name === 'boat'))
    } else if (msg === '.dismount') {
        bot.dismount()
    }
})

Or are you perhaps instantly calling dismount as soon as your bot mounts, since Mineflayer only stores the bots vehicle once the server replies to the mount packet.

extremeheat commented 1 year ago

Reopen if you can still reproduce after running npm update --depth 9999 and make sure to provide runnable code to reproduce