make range initialization more readable

This commit is contained in:
ZacSharp 2021-02-10 10:25:17 +01:00
parent 5926369a56
commit 132cc0e131
No known key found for this signature in database
GPG Key ID: 9453647B005083A3

View File

@ -85,12 +85,12 @@ 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 = Integer.MAX_VALUE;
int minY = from[0].getY() - distance; int minY = Integer.MAX_VALUE;
int minZ = from[0].getZ() - distance; int minZ = Integer.MAX_VALUE;
int maxX = from[0].getX() + distance; int maxX = Integer.MIN_VALUE;
int maxY = from[0].getY() + distance; int maxY = Integer.MIN_VALUE;
int maxZ = from[0].getZ() + distance; int maxZ = Integer.MIN_VALUE;
for (BlockPos p : from) { for (BlockPos p : from) {
minX = Math.min(minX, p.getX() - distance); minX = Math.min(minX, p.getX() - distance);
minY = Math.min(minY, p.getY() - distance); minY = Math.min(minY, p.getY() - distance);