PrismarineJS / mineflayer-navigate

mineflayer plugin which gives bots a high level 3d navigating API using A*
59 stars 22 forks source link

`arrived` event is not fired when walking to nearest path #24

Closed Darker closed 9 years ago

Darker commented 9 years ago

I am too lazy to scan for suitable place and instead, I make the bot walk right into the block he's digging. I've basically just copypasted the code from README.md:

bot.navigate.once('pathFound', function (path) {
  bot.chat("Found path. I can get there in " + path.length + " moves.");
});
bot.navigate.once('cannotFind', function (closestPath) {
  bot.chat("Unable to find path. getting as close as possible");
  bot.navigate.walk(closestPath);
});
bot.navigate.once('arrived', function () {
  bot.chat("I have arrived");
  _this.prepareTool(block, function() {_this.digBlock(block);});
});
bot.navigate.once('interrupted', function() {
  bot.chat("Walk interrupted at "+bot.entity.position);
  _this.prepareTool(block, function() {_this.digBlock(block);});
});
bot.navigate.once('stop', function() {
  bot.chat("Walk stopped at "+bot.entity.position);
  _this.prepareTool(block, function() {_this.digBlock(block);});
});
bot.navigate.to(block.position);
this.bot.chat("Walking to: "+block.position);

And this is the output. As you see, stop is fired, not arrived:

log

rom1504 commented 9 years ago

Works as expected. It didn't arrived to the given position, it stopped close to it.

Darker commented 9 years ago

Ok, that's true.