|
|
@ -331,7 +331,8 @@ private static final int cellGap = 4; |
|
|
|
path.add(start); |
|
|
|
path.add(start); |
|
|
|
Vector3fImmutable current = start; |
|
|
|
Vector3fImmutable current = start; |
|
|
|
boolean obstructed = false; |
|
|
|
boolean obstructed = false; |
|
|
|
while (current.distanceSquared(goal) > 9) |
|
|
|
int count = 0; |
|
|
|
|
|
|
|
while (current.distanceSquared(goal) > 9 && count < 250) |
|
|
|
{ |
|
|
|
{ |
|
|
|
//gather the 8 cells around the player
|
|
|
|
//gather the 8 cells around the player
|
|
|
|
ArrayList<Vector3fImmutable> surroundingCells = new ArrayList<>(); |
|
|
|
ArrayList<Vector3fImmutable> surroundingCells = new ArrayList<>(); |
|
|
@ -346,6 +347,7 @@ private static final int cellGap = 4; |
|
|
|
Vector3fImmutable cheapest = new Vector3fImmutable(-10000, 0, -10000); |
|
|
|
Vector3fImmutable cheapest = new Vector3fImmutable(-10000, 0, -10000); |
|
|
|
for (Vector3fImmutable point : surroundingCells) |
|
|
|
for (Vector3fImmutable point : surroundingCells) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
count++; |
|
|
|
if (path.contains(point)) |
|
|
|
if (path.contains(point)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|