mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +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 c10390c1bdc7b8ee59dbb5ddc145315654405cbc..4cf7763cba388b4c87e8c7f191f344a4ea70e718 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -658,7 +658,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|
Set<Chunk> chunks = new HashSet<>();
|
|
|
|
for (long coord : this.getHandle().getForceLoadedChunks()) {
|
|
- 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);
|