👌formatting in of comments
This commit is contained in:
parent
0c7741120a
commit
3cdbc4cb83
@ -61,7 +61,7 @@ public class GoalComposite implements Goal {
|
|||||||
public double heuristic() {
|
public double heuristic() {
|
||||||
double min = Double.MAX_VALUE;
|
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
|
// just take the highest value that is guaranteed to be inside the goal
|
||||||
min = Math.min(min, g.heuristic());
|
min = Math.min(min, g.heuristic());
|
||||||
}
|
}
|
||||||
return min;
|
return min;
|
||||||
|
@ -55,7 +55,7 @@ public class GoalNear implements Goal, IGoalRenderPos {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double heuristic() {//TODO less hacky solution
|
public double heuristic() {// TODO less hacky solution
|
||||||
int range = (int) Math.ceil(Math.sqrt(rangeSq));
|
int range = (int) Math.ceil(Math.sqrt(rangeSq));
|
||||||
HashSet<Double> maybeAlwaysInside = new HashSet<>();
|
HashSet<Double> maybeAlwaysInside = new HashSet<>();
|
||||||
HashSet<Double> sometimesOutside = new HashSet<>();
|
HashSet<Double> sometimesOutside = new HashSet<>();
|
||||||
|
@ -68,7 +68,7 @@ public class GoalRunAway implements Goal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double heuristic(int x, int y, int z) {//mostly copied from GoalBlock
|
public double heuristic(int x, int y, int z) {// mostly copied from GoalBlock
|
||||||
double min = Double.MAX_VALUE;
|
double min = Double.MAX_VALUE;
|
||||||
for (BlockPos p : from) {
|
for (BlockPos p : from) {
|
||||||
double h = GoalXZ.calculate(p.getX() - x, p.getZ() - z);
|
double h = GoalXZ.calculate(p.getX() - x, p.getZ() - z);
|
||||||
@ -84,7 +84,7 @@ public class GoalRunAway implements Goal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double heuristic() {//TODO less hacky solution
|
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 minX = from[0].getX() - distance;
|
||||||
int minY = from[0].getY() - distance;
|
int minY = from[0].getY() - distance;
|
||||||
|
@ -391,7 +391,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
|||||||
}
|
}
|
||||||
double current = goal.heuristic(currentPos.x, currentPos.y, currentPos.z);
|
double current = goal.heuristic(currentPos.x, currentPos.y, currentPos.z);
|
||||||
double start = goal.heuristic(startPosition.x, startPosition.y, startPosition.z);
|
double start = goal.heuristic(startPosition.x, startPosition.y, startPosition.z);
|
||||||
if (current == start) {//can't check above because current and start can be equal even if currentPos and startPosition are not
|
if (current == start) {// can't check above because current and start can be equal even if currentPos and startPosition are not
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
double eta = Math.abs(current - goal.heuristic()) * ticksElapsedSoFar / Math.abs(start - current);
|
double eta = Math.abs(current - goal.heuristic()) * ticksElapsedSoFar / Math.abs(start - current);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user