Don't use Abs on Sqrt

This commit is contained in:
ZacSharp 2020-10-14 21:14:17 +02:00
parent aebfbba20e
commit e529438c7e
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
2 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ public class GoalNear implements Goal, IGoalRenderPos {
@Override
public double heuristic() {//TODO less hacky solution
int range = (int)Math.ceil(Math.abs(Math.sqrt(rangeSq)));
int range = (int)Math.ceil(Math.sqrt(rangeSq));
HashSet<Double> maybeAlwaysInside = new HashSet<>();
HashSet<Double> sometimesOutside = new HashSet<>();
for (int dx = -range; dx <= range; dx++) {

View File

@ -85,7 +85,7 @@ public class GoalRunAway implements Goal {
@Override
public double heuristic() {//TODO less hacky solution
int distance = (int)Math.ceil(Math.abs(Math.sqrt(distanceSq)));
int distance = (int)Math.ceil(Math.sqrt(distanceSq));
int minX = from[0].getX() - distance;
int minY = from[0].getY() - distance;
int minZ = from[0].getZ() - distance;