1
0
forked from xjboss/KCauldronX

ChunkManager implementation

ChunkManager optimize chunks handling in small and big worlds

Small worlds gets benefits with using int-object map instead long-object (in area -32768...32767 by x and z)

Large worlds gets benefits by using efficient map by Colt project, which a little (3-6%) slower in writing, but greatly faster
(400-500% from Java's HashMap and 150-180% from Trove's maps) on reading.
This commit is contained in:
Sergey Shatunov
2016-02-10 19:17:47 +07:00
parent 6f447f2804
commit 5aaf6c5cbf
12 changed files with 202 additions and 111 deletions

View File

@ -15,7 +15,7 @@
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, queuedChunk.compound)); // Don't call ChunkDataEvent.Load async
chunk.lastSaveTime = queuedChunk.provider.worldObj.getTotalWorldTime();
- queuedChunk.provider.loadedChunkHashMap.add(ChunkCoordIntPair.chunkXZ2Int(queuedChunk.x, queuedChunk.z), chunk);
+ queuedChunk.provider.loadedChunkHashMap_KC.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
+ queuedChunk.provider.chunkManager.putChunk(chunk, queuedChunk.x, queuedChunk.z); // KCauldron
queuedChunk.provider.loadedChunks.add(chunk);
chunk.onChunkLoad();