fix world scanner radius
This commit is contained in:
parent
dfd2ef055e
commit
489b9dea98
@ -47,13 +47,13 @@ public enum WorldScanner implements Helper {
|
|||||||
int playerChunkX = playerFeet().getX() >> 4;
|
int playerChunkX = playerFeet().getX() >> 4;
|
||||||
int playerChunkZ = playerFeet().getZ() >> 4;
|
int playerChunkZ = playerFeet().getZ() >> 4;
|
||||||
|
|
||||||
int searchRadius = 2;
|
int searchRadiusSq = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
boolean allUnloaded = true;
|
boolean allUnloaded = true;
|
||||||
for (int xoff = -searchRadius; xoff <= searchRadius; xoff++) {
|
for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) {
|
||||||
for (int zoff = -searchRadius; zoff <= searchRadius; zoff++) {
|
for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) {
|
||||||
int distance = xoff * xoff + zoff * zoff;
|
int distance = xoff * xoff + zoff * zoff;
|
||||||
if (distance != searchRadius) {
|
if (distance != searchRadiusSq) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int chunkX = xoff + playerChunkX;
|
int chunkX = xoff + playerChunkX;
|
||||||
@ -91,10 +91,10 @@ public enum WorldScanner implements Helper {
|
|||||||
if (allUnloaded) {
|
if (allUnloaded) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (res.size() >= max) {
|
if (res.size() >= max && searchRadiusSq < 26) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
searchRadius++;
|
searchRadiusSq++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user