improve accuracy of GoalGetToBlock heuristic

This commit is contained in:
Leijurv 2018-11-23 10:52:56 -08:00
parent a98c5d7d99
commit d854750ee8
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -48,10 +48,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
int xDiff = x - this.x; int xDiff = x - this.x;
int yDiff = y - this.y; int yDiff = y - this.y;
int zDiff = z - this.z; int zDiff = z - this.z;
if (yDiff < 0) { return Math.abs(xDiff) + Math.abs(yDiff < 0 ? yDiff + 1 : yDiff) + Math.abs(zDiff) <= 1;
yDiff++;
}
return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1;
} }
@Override @Override
@ -59,7 +56,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
int xDiff = x - this.x; int xDiff = x - this.x;
int yDiff = y - this.y; int yDiff = y - this.y;
int zDiff = z - this.z; int zDiff = z - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff); return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff);
} }
@Override @Override