From 0c7741120a10ff617583ffb6bf6eb65f3a4fe3f9 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 15 Oct 2020 00:05:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8Cformatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/baritone/api/pathing/goals/Goal.java | 18 +++++++++--------- .../api/pathing/goals/GoalComposite.java | 2 +- .../baritone/api/pathing/goals/GoalNear.java | 6 +++--- .../api/pathing/goals/GoalRunAway.java | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/api/java/baritone/api/pathing/goals/Goal.java b/src/api/java/baritone/api/pathing/goals/Goal.java index 7d8f4222..95462f96 100644 --- a/src/api/java/baritone/api/pathing/goals/Goal.java +++ b/src/api/java/baritone/api/pathing/goals/Goal.java @@ -56,15 +56,15 @@ public interface Goal { } /** - * Returns the heuristic at the goal. - * i.e. {@code heuristic() == heuristic(x,y,z)} - * when {@code isInGoal(x,y,z) == true} - * This is needed by {@code PathingBehavior#estimatedTicksToGoal} because - * some Goals actually do not have a heuristic of 0 when that condition is met - * - * @return The estimate number of ticks to satisfy the goal when the goal - * is already satisfied - */ + * Returns the heuristic at the goal. + * i.e. {@code heuristic() == heuristic(x,y,z)} + * when {@code isInGoal(x,y,z) == true} + * This is needed by {@code PathingBehavior#estimatedTicksToGoal} because + * some Goals actually do not have a heuristic of 0 when that condition is met + * + * @return The estimate number of ticks to satisfy the goal when the goal + * is already satisfied + */ default double heuristic() { return 0; } diff --git a/src/api/java/baritone/api/pathing/goals/GoalComposite.java b/src/api/java/baritone/api/pathing/goals/GoalComposite.java index fd4e672b..ebaf38ed 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalComposite.java +++ b/src/api/java/baritone/api/pathing/goals/GoalComposite.java @@ -60,7 +60,7 @@ public class GoalComposite implements Goal { @Override public double heuristic() { double min = Double.MAX_VALUE; - for (Goal g: goals) { + for (Goal g : goals) { //just take the highest value that is guaranteed to be inside the goal min = Math.min(min, g.heuristic()); } diff --git a/src/api/java/baritone/api/pathing/goals/GoalNear.java b/src/api/java/baritone/api/pathing/goals/GoalNear.java index c7e932e2..0657c172 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalNear.java +++ b/src/api/java/baritone/api/pathing/goals/GoalNear.java @@ -56,14 +56,14 @@ public class GoalNear implements Goal, IGoalRenderPos { @Override public double heuristic() {//TODO less hacky solution - int range = (int)Math.ceil(Math.sqrt(rangeSq)); + int range = (int) Math.ceil(Math.sqrt(rangeSq)); HashSet maybeAlwaysInside = new HashSet<>(); HashSet sometimesOutside = new HashSet<>(); for (int dx = -range; dx <= range; dx++) { for (int dy = -range; dy <= range; dy++) { for (int dz = -range; dz <= range; dz++) { - double h = heuristic(x+dx, y+dy, z+dz); - if (!sometimesOutside.contains(h) && isInGoal(x+dx, y+dy, z+dz)) { + double h = heuristic(x + dx, y + dy, z + dz); + if (!sometimesOutside.contains(h) && isInGoal(x + dx, y + dy, z + dz)) { maybeAlwaysInside.add(h); } else { maybeAlwaysInside.remove(h); diff --git a/src/api/java/baritone/api/pathing/goals/GoalRunAway.java b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java index 9ee1b151..7983d6fc 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalRunAway.java +++ b/src/api/java/baritone/api/pathing/goals/GoalRunAway.java @@ -85,7 +85,7 @@ public class GoalRunAway implements Goal { @Override public double heuristic() {//TODO less hacky solution - int distance = (int)Math.ceil(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;