-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
1 parent
e278a1f
commit 1c3b2ff
Showing
12 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
leaf-server/minecraft-patches/features/0124-ensureCapacity-with-collectTickingChunks.patch
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,33 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Taiyou06 <[email protected]> | ||
Date: Sun, 16 Feb 2025 01:13:04 +0100 | ||
Subject: [PATCH] ensureCapacity with collectTickingChunks | ||
|
||
|
||
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java | ||
index dd956431bb882daa70267685f2283d0c358336be..ca12b33b1297afcb211bf9a4e423ee11c1ec57e9 100644 | ||
--- a/net/minecraft/server/level/ServerChunkCache.java | ||
+++ b/net/minecraft/server/level/ServerChunkCache.java | ||
@@ -573,17 +573,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon | ||
final ServerChunkCache.ChunkAndHolder[] raw = tickingChunks.getRawDataUnchecked(); | ||
final int size = tickingChunks.size(); | ||
|
||
- final ChunkMap chunkMap = this.chunkMap; | ||
+ // Directly add all pre-filtered ticking chunks to output | ||
+ if (output instanceof ArrayList<LevelChunk> arrayList) { | ||
+ arrayList.ensureCapacity(size); | ||
+ } | ||
|
||
for (int i = 0; i < size; ++i) { | ||
- final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i]; | ||
- final LevelChunk levelChunk = chunkAndHolder.chunk(); | ||
- | ||
- if (!this.isChunkNearPlayer(chunkMap, levelChunk.getPos(), levelChunk)) { | ||
- continue; | ||
- } | ||
- | ||
- output.add(levelChunk); | ||
+ output.add(raw[i].chunk()); | ||
} | ||
// Paper end - chunk tick iteration optimisation | ||
} |
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.