This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: 404Setup <153366651+404Setup@users.noreply.github.com> | ||
Date: Tue, 12 Nov 2024 15:31:47 +0800 | ||
Subject: [PATCH] Paper optimize getChunkCount | ||
|
||
It was returning ticking chunk count instead of the intended full chunk count. | ||
We can also directly use the size of the fullChunks collection instead of iterating all chunks. | ||
|
||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java | ||
index e8e9af9128e8cbdba3664f5afa3c5f56403fe70e..dc6e1258c6fdaaa3cae8d4f26f1640b8567a65d7 100644 | ||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java | ||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java | ||
@@ -67,6 +67,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon | ||
// Folia - moved to regionised world data | ||
// Paper start | ||
private final ca.spottedleaf.concurrentutil.map.ConcurrentLong2ReferenceChainedHashTable<net.minecraft.world.level.chunk.LevelChunk> fullChunks = new ca.spottedleaf.concurrentutil.map.ConcurrentLong2ReferenceChainedHashTable<>(); | ||
+ public int getFullChunksCount() { return this.fullChunks.size(); } | ||
long chunkFutureAwaitCounter; | ||
// Paper end | ||
// Paper start - rewrite chunk system | ||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java | ||
index e6e83eb3974f0963916b36281b5e2ab647ae7cb8..3c022b12b5376457fd4e51499fcafc4e58d9caae 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java | ||
@@ -232,15 +232,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { | ||
|
||
@Override | ||
public int getChunkCount() { | ||
- int ret = 0; | ||
- | ||
- for (ChunkHolder chunkHolder : ca.spottedleaf.moonrise.common.util.ChunkSystem.getVisibleChunkHolders(this.world)) { | ||
- if (chunkHolder.getTickingChunk() != null) { | ||
- ++ret; | ||
- } | ||
- } | ||
- | ||
- return ret; | ||
+ return this.world.getChunkSource().getFullChunksCount(); | ||
} | ||
|
||
@Override |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.