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:
Ursprung
02807238c4
Commit
a50d7c340b
@ -20616,15 +20616,16 @@ index e96a0ca47e4701ba187555bd92c968345bc85677..73b96f804079288e9c5fcc11da54e61e
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
|
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
|
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
|
||||||
+++ b/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());
|
this.pendingChunks.add(chunk.getPos().toLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - rewrite player chunk loader
|
+ // Paper start - rewrite player chunk loader
|
||||||
+ public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
|
+ public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
|
||||||
|
+ player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player);
|
||||||
+ player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
|
+ player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - rewrite player chunk loader
|
+ // Paper end - rewrite player chunk loader
|
||||||
@ -20642,16 +20643,17 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..0f7ee2eea68a5c910bdf4d6263ed09cb
|
|||||||
if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) {
|
if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) {
|
||||||
float f = Math.max(1.0F, this.desiredChunksPerTick);
|
float f = Math.max(1.0F, this.desiredChunksPerTick);
|
||||||
this.batchQuota = Math.min(this.batchQuota + this.desiredChunksPerTick, f);
|
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) {
|
- 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
|
+ 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));
|
handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null));
|
||||||
ChunkPos chunkPos = chunk.getPos();
|
ChunkPos chunkPos = chunk.getPos();
|
||||||
DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
|
DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
|
||||||
@@ -100,6 +107,7 @@ public class PlayerChunkSender {
|
@@ -100,6 +109,7 @@ public class PlayerChunkSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onChunkBatchReceivedByClient(float desiredBatchSize) {
|
public void onChunkBatchReceivedByClient(float desiredBatchSize) {
|
||||||
|
@ -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
|
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
|
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
|
||||||
+++ b/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 {
|
@@ -46,6 +46,11 @@ public class PlayerChunkSender {
|
||||||
// Paper start - rewrite player chunk loader
|
|
||||||
public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
|
public static void dropChunkStatic(ServerPlayer player, ChunkPos pos) {
|
||||||
|
player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(pos.toLong()).removePlayer(player);
|
||||||
player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
|
player.connection.send(new ClientboundForgetLevelChunkPacket(pos));
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
+ if (io.papermc.paper.event.packet.PlayerChunkUnloadEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
||||||
@ -20,9 +20,9 @@ index 0f7ee2eea68a5c910bdf4d6263ed09cbed592516..ef85236b958d8187959c7d446bc2f3c7
|
|||||||
}
|
}
|
||||||
// Paper end - rewrite player chunk loader
|
// 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
|
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));
|
handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null));
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
+ if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren