From 7a108cda403b36bc9f258c07908b8cd2f531ae17 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 22 Sep 2023 17:07:02 -0700 Subject: [PATCH] Make sure to maintain the players sent to set for ChunkHolder Required for proper block/light updates to clients --- patches/server/Player-Chunk-Load-Unload-Events.patch | 4 ++-- patches/server/Rewrite-chunk-system.patch | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/server/Player-Chunk-Load-Unload-Events.patch b/patches/server/Player-Chunk-Load-Unload-Events.patch index 6d63186310..55bd80cf94 100644 --- a/patches/server/Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/Player-Chunk-Load-Unload-Events.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java @@ -0,0 +0,0 @@ public class PlayerChunkSender { - // Paper start - rewrite player chunk loader public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) { + player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player); player.connection.send(new ClientboundForgetLevelChunkPacket(pos)); + // Paper start + if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) { @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end - rewrite player chunk loader @@ -0,0 +0,0 @@ public class PlayerChunkSender { - public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public + handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); + // Paper start + if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { diff --git a/patches/server/Rewrite-chunk-system.patch b/patches/server/Rewrite-chunk-system.patch index 894619a83c..8f6f08b936 100644 --- a/patches/server/Rewrite-chunk-system.patch +++ b/patches/server/Rewrite-chunk-system.patch @@ -20625,6 +20625,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - rewrite player chunk loader + public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) { ++ player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player); + player.connection.send(new ClientboundForgetLevelChunkPacket(pos)); + } + // Paper end - rewrite player chunk loader @@ -20648,6 +20649,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { + public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public ++ handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); ChunkPos chunkPos = chunk.getPos(); DebugPackets.sendPoiPacketsForChunk(world, chunkPos);