mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-30 20:39:21 +00:00
30 lines
1.5 KiB
Diff
30 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 5 Jun 2025 14:55:57 -0700
|
|
Subject: [PATCH] Paper: Update CraftWorld#getForceLoadedChunks to avoid using
|
|
getChunkAt
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/PaperMC/Paper
|
|
|
|
https://github.com/PaperMC/Paper/commit/774c40e71297c6e6d7d417639e1ce61cc79cc5ba
|
|
|
|
Usual methods of adding force loaded chunks sync load them, so
|
|
they should be loaded already. This should avoid the more expensive
|
|
getChunkAt and more importantly allow this function to properly work
|
|
on Folia due to avoiding thread checks.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index 236be1bb296d0f080d2a8c739d2678655e81e174..64d95bc035fbafa660e7f3d7393da4bf8839b2f9 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -657,7 +657,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
Set<Chunk> chunks = new HashSet<>();
|
|
|
|
for (long coord : this.getHandle().getForcedChunks()) {
|
|
- chunks.add(this.getChunkAt(ChunkPos.getX(coord), ChunkPos.getZ(coord)));
|
|
+ chunks.add(new CraftChunk(this.getHandle(), ChunkPos.getX(coord), ChunkPos.getZ(coord))); // Paper - Update CraftWorld#getForceLoadedChunks to avoid using getChunkAt
|
|
}
|
|
|
|
return Collections.unmodifiableCollection(chunks);
|