Configurable chunk map caching

This commit is contained in:
Byteflux 2015-07-15 16:16:27 -07:00
parent b5666dd9e8
commit e3e7539232
1 changed files with 22 additions and 3 deletions

View File

@ -1,14 +1,14 @@
From 5cf461979b07c8b31867b7e64c36fa6bc4a2e8fa Mon Sep 17 00:00:00 2001 From 7511cc6c50a7351c6359daa9425d119947cb4338 Mon Sep 17 00:00:00 2001
From: Iceee <andrew@opticgaming.tv> From: Iceee <andrew@opticgaming.tv>
Date: Wed, 15 Jul 2015 02:41:12 -0700 Date: Wed, 15 Jul 2015 02:41:12 -0700
Subject: [PATCH] ChunkMap caching Subject: [PATCH] ChunkMap caching
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index ab4de94..2b70bf4 100644 index ab4de94..c9885ca 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -50,6 +50,39 @@ public class Chunk { @@ -50,6 +50,43 @@ public class Chunk {
public long lightUpdateTime; public long lightUpdateTime;
// PaperSpigot end // PaperSpigot end
@ -17,6 +17,10 @@ index ab4de94..2b70bf4 100644
+ private int emptySectionBits; + private int emptySectionBits;
+ +
+ public PacketPlayOutMapChunk.ChunkMap getChunkMap() { + public PacketPlayOutMapChunk.ChunkMap getChunkMap() {
+ if (!world.paperSpigotConfig.cacheChunkMaps) {
+ return PacketPlayOutMapChunk.a(this, true, !world.worldProvider.o(), '\uffff');
+ }
+
+ boolean isDirty = false; + boolean isDirty = false;
+ for (int i = 0; i < sections.length; ++i) { + for (int i = 0; i < sections.length; ++i) {
+ ChunkSection section = sections[i]; + ChunkSection section = sections[i];
@ -110,6 +114,21 @@ index 10c0e34..f7e8ab3 100644
this.a[j] = chunk.locX; this.a[j] = chunk.locX;
this.b[j] = chunk.locZ; this.b[j] = chunk.locZ;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 9c8a01b..cde11b2 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -390,4 +390,10 @@ public class PaperSpigotWorldConfig
{
mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 );
}
+
+ public boolean cacheChunkMaps;
+ private void cacheChunkMaps()
+ {
+ cacheChunkMaps = getBoolean( "cache-chunk-maps", false );
+ }
}
-- --
1.9.5.msysgit.1 1.9.5.msysgit.1