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

Fix path starting position while sneaking #209

Closed
leijurv opened this issue Oct 6, 2018 · 4 comments
Closed

Fix path starting position while sneaking #209

leijurv opened this issue Oct 6, 2018 · 4 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@leijurv
Copy link
Member

leijurv commented Oct 6, 2018

If you sneak off the edge of a block and start a path, the starting position will be not actually supported. If it was off the edge of a cliff, it's possible that the first movement will cause the player to just fall off.

Right now there is a heuristic, here:
https://github.com/cabaletta/baritone/blame/master/src/main/java/baritone/behavior/PathingBehavior.java#L259
ee8e44d

It's okay, but only if you're sneaking over a 1-high ledge.
It also requires this sketchy workaround:
https://github.com/cabaletta/baritone/blob/master/src/main/java/baritone/pathing/path/PathExecutor.java#L97

Which isn't great.

Instead we should figure out which block is actually supporting us. I don't really know how to do this.
First off, don't do any of this if the block below playerFeet is canWalkOn.
In the scenario where our current position isn't a valid place to start a path, we need to check the 8 adjacent blocks to see if they're supporting us.

@leijurv leijurv added bug Something isn't working enhancement New feature or request labels Oct 6, 2018
@leijurv leijurv added this to the 1.0.0 milestone Oct 6, 2018
@ZeroMemes
Copy link
Member

Once the pathStart method is fixed, that workaround could be removed, correct?

@leijurv
Copy link
Member Author

leijurv commented Oct 7, 2018

yes

@leijurv
Copy link
Member Author

leijurv commented Oct 8, 2018

lol this is the same as #70

@leijurv
Copy link
Member Author

leijurv commented Oct 11, 2018

I've come up with a "good enough" solution, in my opinion

  • In the scenario where we are on the ground, yet the block directly below our feet isn't canWalkOn (i.e. we're sneaking off an edge), figure out the block we're sneaking off of, and start a path from there
  • In the scenario where we are not on the ground, and the block directly below our feet isn't canWalkOn, but the block directly below that is canWalkOn, move our starting block down by one
  • In all other scenarios, playerFeet is the path start

Here is a video demonstrating that algorithm in action, the block highlighted in white is where a path would start:
https://youtu.be/5jlVmMXFCxU

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

No branches or pull requests

2 participants