Make sure to maintain the players sent to set for ChunkHolder

Required for proper block/light updates to clients
This commit is contained in:
Spottedleaf 2023-09-22 17:07:02 -07:00
parent 910c6b25b9
commit 7a108cda40
2 changed files with 4 additions and 2 deletions

View file

@ -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) {

View file

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