Optimize chunk filter a little

This commit is contained in:
Blue (Lukas Rieger) 2020-07-29 17:06:50 +02:00
parent 7f0df85b6f
commit d97560cc82

View File

@ -282,6 +282,9 @@ public Collection<Vector2i> getChunkList(long modifiedSinceMillis, Predicate<Vec
for (int x = 0; x < 32; x++) {
for (int z = 0; z < 32; z++) {
Vector2i chunk = new Vector2i(rX * 32 + x, rZ * 32 + z);
if (filter.test(chunk)) {
int xzChunk = z * 32 + x;
raf.seek(xzChunk * 4 + 3);
@ -296,10 +299,9 @@ public Collection<Vector2i> getChunkList(long modifiedSinceMillis, Predicate<Vec
timestamp |= raf.read() & 0xFF;
if (timestamp >= (modifiedSinceMillis / 1000)) {
Vector2i chunk = new Vector2i(rX * 32 + x, rZ * 32 + z);
if (filter.test(chunk)) {
chunks.add(chunk);
}
}
}
}