Unload client chunks + only cache whole chunk maps

This commit is contained in:
Byteflux 2015-07-16 14:06:33 -07:00
parent d0249a6935
commit 9491916ffa

View File

@ -16,9 +16,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ private PacketPlayOutMapChunk.ChunkMap chunkMap;
+ private int emptySectionBits;
+
+ public PacketPlayOutMapChunk.ChunkMap getChunkMap() {
+ if (!world.paperSpigotConfig.cacheChunkMaps) {
+ return PacketPlayOutMapChunk.a(this, true, !world.worldProvider.o(), '\uffff');
+ public PacketPlayOutMapChunk.ChunkMap getChunkMap(boolean groundUpContinuous, int primaryBitMask) {
+ if (!world.paperSpigotConfig.cacheChunkMaps || !groundUpContinuous || (primaryBitMask != 0 && primaryBitMask != '\uffff')) {
+ return PacketPlayOutMapChunk.a(this, groundUpContinuous, !world.worldProvider.o(), primaryBitMask);
+ }
+
+ if (primaryBitMask == 0) {
+ PacketPlayOutMapChunk.ChunkMap chunkMap = new PacketPlayOutMapChunk.ChunkMap();
+ chunkMap.a = new byte[0];
+ return chunkMap;
+ }
+
+ boolean isDirty = false;
@ -97,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.b = chunk.locZ;
this.d = flag;
- this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i);
+ this.c = chunk.getChunkMap(); // PaperSpigot
+ this.c = chunk.getChunkMap(flag, i); // PaperSpigot
chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world);
}
@ -110,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
for (int j = 0; j < i; ++j) {
Chunk chunk = (Chunk) list.get(j);
- PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff');
+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = chunk.getChunkMap(); // PaperSpigot
+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = chunk.getChunkMap(true, '\uffff'); // PaperSpigot
this.a[j] = chunk.locX;
this.b[j] = chunk.locZ;