3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Make sure to maintain the players sent to set for ChunkHolder

Required for proper block/light updates to clients
Dieser Commit ist enthalten in:
Spottedleaf 2023-09-22 17:07:02 -07:00
Ursprung 02807238c4
Commit a50d7c340b
2 geänderte Dateien mit 11 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -20616,15 +20616,16 @@ index e96a0ca47e4701ba187555bd92c968345bc85677..73b96f804079288e9c5fcc11da54e61e
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
index c509a1318bcef38fd4927e38b6ee9846853e2d15..0f7ee2eea68a5c910bdf4d6263ed09cbed592516 100644
index c509a1318bcef38fd4927e38b6ee9846853e2d15..5de5209e04d631bd6a50e28e8d3abebf148252c1 100644
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
@@ -42,14 +42,21 @@ public class PlayerChunkSender {
@@ -42,14 +42,22 @@ public class PlayerChunkSender {
this.pendingChunks.add(chunk.getPos().toLong());
}
+ // 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
@ -20642,16 +20643,17 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..0f7ee2eea68a5c910bdf4d6263ed09cb
if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) {
float f = Math.max(1.0F, this.desiredChunksPerTick);
this.batchQuota = Math.min(this.batchQuota + this.desiredChunksPerTick, f);
@@ -75,7 +82,7 @@ public class PlayerChunkSender {
@@ -75,7 +83,8 @@ public class PlayerChunkSender {
}
}
- 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);
@@ -100,6 +107,7 @@ public class PlayerChunkSender {
@@ -100,6 +109,7 @@ public class PlayerChunkSender {
}
public void onChunkBatchReceivedByClient(float desiredBatchSize) {

Datei anzeigen

@ -5,12 +5,12 @@ Subject: [PATCH] Player Chunk Load/Unload Events
diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
index 0f7ee2eea68a5c910bdf4d6263ed09cbed592516..ef85236b958d8187959c7d446bc2f3c7480854bb 100644
index 5de5209e04d631bd6a50e28e8d3abebf148252c1..f8924bc2f82e7563419ce98153f9fb87d4ed2547 100644
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
@@ -45,6 +45,11 @@ public class PlayerChunkSender {
// Paper start - rewrite player chunk loader
@@ -46,6 +46,11 @@ public class PlayerChunkSender {
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) {
@ -20,9 +20,9 @@ index 0f7ee2eea68a5c910bdf4d6263ed09cbed592516..ef85236b958d8187959c7d446bc2f3c7
}
// Paper end - rewrite player chunk loader
@@ -84,6 +89,11 @@ public class PlayerChunkSender {
@@ -86,6 +91,11 @@ 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) {