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);