Update more feature patches
This commit is contained in:
@@ -6,13 +6,13 @@ Subject: [PATCH] Optimise getChunkAt calls for loaded chunks
|
||||
bypass the need to get a player chunk, then get the either,
|
||||
then unwrap it...
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||
return this.getChunk(x, z, leastStatus, create);
|
||||
}, this.mainThreadProcessor).join();
|
||||
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
|
||||
index d310e7489fc4ecede8deef59241444769d87b0a1..f268808cb250e374f2d5652b20eece011e87dcfb 100644
|
||||
--- a/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -218,6 +218,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
if (Thread.currentThread() != this.mainThread) {
|
||||
return CompletableFuture.<ChunkAccess>supplyAsync(() -> this.getChunk(x, z, chunkStatus, requireChunk), this.mainThreadProcessor).join();
|
||||
} else {
|
||||
+ // Paper start - Perf: Optimise getChunkAt calls for loaded chunks
|
||||
+ LevelChunk ifLoaded = this.getChunkAtIfLoadedMainThread(x, z);
|
||||
@@ -20,41 +20,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return ifLoaded;
|
||||
+ }
|
||||
+ // Paper end - Perf: Optimise getChunkAt calls for loaded chunks
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.incrementCounter("getChunk");
|
||||
@@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource {
|
||||
ProfilerFiller profilerFiller = Profiler.get();
|
||||
profilerFiller.incrementCounter("getChunk");
|
||||
long packedChunkPos = ChunkPos.asLong(x, z);
|
||||
@@ -252,30 +258,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
if (Thread.currentThread() != this.mainThread) {
|
||||
return null;
|
||||
} else {
|
||||
- Profiler.get().incrementCounter("getChunkNow");
|
||||
- long k = ChunkPos.asLong(chunkX, chunkZ);
|
||||
- long packedChunkPos = ChunkPos.asLong(chunkX, chunkZ);
|
||||
-
|
||||
- ChunkAccess ichunkaccess;
|
||||
-
|
||||
- for (int l = 0; l < 4; ++l) {
|
||||
- if (k == this.lastChunkPos[l] && this.lastChunkStatus[l] == ChunkStatus.FULL) {
|
||||
- ichunkaccess = this.lastChunk[l];
|
||||
- return ichunkaccess instanceof LevelChunk ? (LevelChunk) ichunkaccess : null;
|
||||
- for (int i = 0; i < 4; i++) {
|
||||
- if (packedChunkPos == this.lastChunkPos[i] && this.lastChunkStatus[i] == ChunkStatus.FULL) {
|
||||
- ChunkAccess chunkAccess = this.lastChunk[i];
|
||||
- return chunkAccess instanceof LevelChunk ? (LevelChunk)chunkAccess : null;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ChunkHolder playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
-
|
||||
- if (playerchunk == null) {
|
||||
- ChunkHolder visibleChunkIfPresent = this.getVisibleChunkIfPresent(packedChunkPos);
|
||||
- if (visibleChunkIfPresent == null) {
|
||||
- return null;
|
||||
- } else {
|
||||
- ichunkaccess = playerchunk.getChunkIfPresent(ChunkStatus.FULL);
|
||||
- if (ichunkaccess != null) {
|
||||
- this.storeInCache(k, ichunkaccess, ChunkStatus.FULL);
|
||||
- if (ichunkaccess instanceof LevelChunk) {
|
||||
- return (LevelChunk) ichunkaccess;
|
||||
- ChunkAccess chunkAccess = visibleChunkIfPresent.getChunkIfPresent(ChunkStatus.FULL);
|
||||
- if (chunkAccess != null) {
|
||||
- this.storeInCache(packedChunkPos, chunkAccess, ChunkStatus.FULL);
|
||||
- if (chunkAccess instanceof LevelChunk) {
|
||||
- return (LevelChunk)chunkAccess;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return null;
|
||||
- }
|
||||
+ return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunks
|
||||
+ return this.getChunkAtIfLoadedMainThread(chunkX, chunkZ); // Paper - Perf: Optimise getChunkAt calls for loaded chunk
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user