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

Bot doesn't jump over a 2 block gap 1 block lower than it.

Open GoogleSites opened this issue 6 years ago • 8 comments

Bot keeps getting stuck in this type of scenario:

https://gyazo.com/f9f36242c761fc442da3247542517ab4

Make this and have the bot walk over it and it'll fall each time - doesn't even try to jump the gap.

GoogleSites avatar Jun 12 '19 11:06 GoogleSites

Here's a video: https://youtu.be/TfIrl4GpYGQ

An easy way to fix this is to have the bot jump - it can make it over easily without sprinting.

GoogleSites avatar Jun 13 '19 00:06 GoogleSites

Here's another path-finding issue (same type of thing): https://gyazo.com/8ecb5c78b2d921df898fd8d7b6ff48de

GoogleSites avatar Jun 15 '19 00:06 GoogleSites

Indeed looks like a bug related to jumping in mineflayer. You can try to tweak jumping in mineflayer and tweak the way it's used in mineflayer-navigate

rom1504 avatar Jun 15 '19 09:06 rom1504

For mineflayer-navigate, do you mean this code block?

  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  }
  bot.setControlState('jump', gottaJump);

GoogleSites avatar Jun 15 '19 12:06 GoogleSites

Yes

rom1504 avatar Jun 15 '19 13:06 rom1504

I guess it doesn't jump for long enough

rom1504 avatar Jun 15 '19 13:06 rom1504

Kinda rough but this works. I'll clean it up later.

  if (delta.y > 0.1) {
    // gotta jump up when we're close enough
    gottaJump = horizontalDelta < 1.75;
  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  } else if (Math.floor(nextPoint.y) === Math.floor(currentPosition.y - 1)) {
    gottaJump = 1.5 < horizontalDelta && horizontalDelta <= 4;
  }
  bot.setControlState('jump', gottaJump);

GoogleSites avatar Jun 15 '19 14:06 GoogleSites

better version:

  if (delta.y > 0.1) {
    // gotta jump up when we're close enough
    gottaJump = horizontalDelta < 1.75;
  } else if (delta.y > -0.1) {
    // possibly jump over a hole
    gottaJump = 1.5 < horizontalDelta && horizontalDelta < 2.5;
  } else if (delta.y < -0.1) {
    // possibly jump over a hole 1 block lower
    gottaJump = 3 < horizontalDelta && horizontalDelta <= 4;
  }
  bot.setControlState('jump', gottaJump);

GoogleSites avatar Jun 16 '19 21:06 GoogleSites