Fix World#refreshChunk not working for chunks in no-tick range

The chunk would not be marked as ticking in this case, so
retrieving the ticking chunk would not work.
This commit is contained in:
Spottedleaf 2022-09-01 15:39:24 -07:00
parent 90da9124c5
commit 0ee53db50a

View file

@ -2082,6 +2082,34 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
if (playerChunk == null) return false;
- playerChunk.getTickingChunkFuture().thenAccept(either -> {
- either.left().ifPresent(chunk -> {
+ // Paper start - rewrite player chunk loader
+ net.minecraft.world.level.chunk.LevelChunk chunk = playerChunk.getSendingChunk();
+ if (chunk == null) {
+ return false;
+ }
+ // Paper end - rewrite player chunk loader
List<ServerPlayer> playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false);
- if (playersInRange.isEmpty()) return;
+ if (playersInRange.isEmpty()) return true; // Paper - rewrite player chunk loader
// Paper start - Anti-Xray - Bypass
Map<Object, ClientboundLevelChunkWithLightPacket> refreshPackets = new HashMap<>();
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}));
// Paper end
}
- });
- });
+ // Paper - rewrite player chunk loader
return true;
}
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot start
@Override