diff options
Diffstat (limited to 'src/main/java/makamys/lodmod/renderer/LODRenderer.java')
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index 56ca600..3a0ff9d 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -159,12 +159,14 @@ public class LODRenderer { for(int x = -renderRange; x <= renderRange; x++) { for(int z = -renderRange; z <= renderRange; z++) { - int chunkX = centerX + x; - int chunkZ = centerZ + z; - - if(getLODChunk(chunkX, chunkZ).needsChunk) { - newServerChunkLoadQueue.add(new ChunkCoordIntPair(chunkX, chunkZ)); - getLODChunk(chunkX, chunkZ).needsChunk = false; + if(x * x + z * z < renderRange * renderRange) { + int chunkX = centerX + x; + int chunkZ = centerZ + z; + + if(getLODChunk(chunkX, chunkZ).needsChunk) { + newServerChunkLoadQueue.add(new ChunkCoordIntPair(chunkX, chunkZ)); + getLODChunk(chunkX, chunkZ).needsChunk = false; + } } } } @@ -178,7 +180,7 @@ public class LODRenderer { ChunkCoordIntPair k = it.next(); LODRegion v = loadedRegionsMap.get(k); - if(!v.tick(player)) { + if(v.distanceTaxicab(player) > renderRange * 16 + 16 * 16) { System.out.println("unloading " + v); v.destroy(getSaveDir()); it.remove(); |