Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Question about cost calculation

stylextv opened this issue ยท 0 comments

commented

What do you need help with?

I was browsing baritone's source code and eventually stumbled across this line in GoalBlock.java:

heuristic += GoalYLevel.calculate(yDiff, 0);

It seems to use a function of the 'GoalYLevel' class to calculate a cost estimate for the difference in y between the current position and the goal. What confuses me is this: Assuming the current y position is, say, 100 and the goalY is 0, then yDiff would be posY - goalY = 100, which means we are 100 blocks above the goal, right? If so, why do we specify 100 as goalY and 0 as the current y position in the line linked above? Wouldn't that lead to a cost that assumes we are 100 blocks below the goal, when in fact we are 100 above it? If so, the arguments in the mentioned line should be swapped, right?

Judging by the number of contributors to this project, I'm probably getting something wrong, but I can't figure out what.

Final checklist

  • I know how to properly use check boxes
  • I have not used any OwO's or UwU's in this issue.