Add explanation and add extra check
This commit is contained in:
parent
c39b6c3fe7
commit
9935da8a6f
@ -388,7 +388,12 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
// Since MovementDescend can't know the next movement we have to tell it
|
||||
if (next instanceof MovementTraverse || next instanceof MovementParkour) {
|
||||
boolean couldPlaceInstead = Baritone.settings().allowPlace.value && behavior.baritone.getInventoryBehavior().hasGenericThrowaway() && next instanceof MovementParkour; // traverse doesn't react fast enough
|
||||
boolean sameFlatDirection = current.getDirection().up().crossProduct(next.getDirection()).equals(BlockPos.ORIGIN); // here's why you learn maths in school
|
||||
// this is true if the next movement does not ascend or descends and goes into the same cardinal direction (N-NE-E-SE-S-SW-W-NW) as the descend
|
||||
// in that case current.getDirection() is e.g. (0, -1, 1) and next.getDirection() is e.g. (0, 0, 3) so the cross product of (0, 0, 1) and (0, 0, 3) is taken, which is (0, 0, 0) because the vectors are colinear (don't form a plane)
|
||||
// since movements in exactly the opposite direction (e.g. descend (0, -1, 1) and traverse (0, 0, -1)) would also pass this check we also have to rule out that case
|
||||
// we can do that by adding the directions because traverse is always 1 long like descend and parkour can't jump through current.getSrc().down()
|
||||
boolean sameFlatDirection = !current.getDirection().up().add(next.getDirection()).equals(BlockPos.ORIGIN)
|
||||
&& current.getDirection().up().crossProduct(next.getDirection()).equals(BlockPos.ORIGIN); // here's why you learn maths in school
|
||||
if (sameFlatDirection && !couldPlaceInstead) {
|
||||
((MovementDescend) current).forceSafeMode();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user