Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping into water/using water bucket to negate fall damage #31

Open
Garfield100 opened this issue Jul 25, 2020 · 1 comment
Open

Dropping into water/using water bucket to negate fall damage #31

Garfield100 opened this issue Jul 25, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@Garfield100
Copy link

Garfield100 commented Jul 25, 2020

Currently the bot isn't able to drop into water, much less use a bucket to avoid fall damage. These would be nice features. I've somewhat successfully added an idea to my code but it fails for small bodies of water when falling from very high up as the bot seems to continue moving in the air and thus not fall on the predicted block.
To fix this, I think it would be a good idea to prevent lateral movement when attempting to fall into water.
This is what I have currently: (It's terrible but works as a proof of concept)

  getLandingBlock(node, dir) {
    let blockLand = this.getBlock(node, dir.x, -2, dir.z)
    for (let i = 0; i < 100; i++) {
      if (i < this.maxDropDown - 1) {
        if (blockLand.physical || !blockLand.safe) break
        blockLand = this.getBlock(node, dir.x, -2 - i, dir.z)
      }

      let possibleBlockLand = this.getBlock(node, dir.x, -2 - i, dir.z);
      if (possibleBlockLand.liquid && possibleBlockLand.safe) {
        blockLand = possibleBlockLand;
        break;
      }

    }
    return blockLand
  }

I also had to change the if (!blockLand.physical) return checks in getMoveDropDown and getMoveDown to allow liquids. Are they even necessary if getLandingBlock returns only correct blocks anyway?

I'd make a pull request but this is nowhere near good enough yet.

@TheDudeFromCI
Copy link
Member

This is a planned feature after the modular pathfinding framework is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants