Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Feb 24, 2025
1 parent e278a1f commit 1c3b2ff
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 0 deletions.
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
}

0 comments on commit 1c3b2ff

Please sign in to comment.