Fix heuristic(no args) returning wrong values
This commit is contained in:
parent
9393192036
commit
fd61207709
@ -71,7 +71,13 @@ public class GoalNear implements Goal, IGoalRenderPos {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.max(maybeAlwaysInside);
|
double maxInside = Double.NEGATIVE_INFINITY;
|
||||||
|
for (double inside : maybeAlwaysInside) {
|
||||||
|
if (inside < minOutside) {
|
||||||
|
maxInside = Math.max(maxInside, inside);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return maxInside;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +23,6 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.NoSuchElementException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful for automated combat (retreating specifically)
|
* Useful for automated combat (retreating specifically)
|
||||||
@ -114,11 +113,13 @@ public class GoalRunAway implements Goal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
double maxInside = Double.NEGATIVE_INFINITY;
|
||||||
return Collections.max(maybeAlwaysInside);
|
for (double inside : maybeAlwaysInside) {
|
||||||
} catch (NoSuchElementException e) {
|
if (inside < minOutside) {
|
||||||
return Double.NEGATIVE_INFINITY;
|
maxInside = Math.max(maxInside, inside);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return maxInside;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user