aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0503-Player-Chunk-Load-Unload-Events.patch
diff options
context:
space:
mode:
authorTomTom <[email protected]>2023-11-03 15:05:57 +0100
committerGitHub <[email protected]>2023-11-03 14:05:57 +0000
commit487109fddc74813b81bf17dfe8ec7be443963d9d (patch)
tree8fbfe1ec07553dc9149882389257d948b0486e02 /patches/server/0503-Player-Chunk-Load-Unload-Events.patch
parent8493340be4fa69fa9369719272e5dff1b7a2f455 (diff)
downloadPaper-487109fddc74813b81bf17dfe8ec7be443963d9d.tar.gz
Paper-487109fddc74813b81bf17dfe8ec7be443963d9d.zip
Readd 0414 use distance map to optimise entity tracker (#9868)
Diffstat (limited to 'patches/server/0503-Player-Chunk-Load-Unload-Events.patch')
-rw-r--r--patches/server/0503-Player-Chunk-Load-Unload-Events.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/server/0503-Player-Chunk-Load-Unload-Events.patch b/patches/server/0503-Player-Chunk-Load-Unload-Events.patch
new file mode 100644
index 0000000000..504b607773
--- /dev/null
+++ b/patches/server/0503-Player-Chunk-Load-Unload-Events.patch
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ysl3000 <[email protected]>
+Date: Mon, 5 Oct 2020 21:25:16 +0200
+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 19b3f4fa7678a038bf25efc2a8b46ddad0193fde..cfeb85b89a7f3dbc856fe7ebdf0bd6a9f3761f1c 100644
+--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
++++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+@@ -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) {
++ new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(pos.longKey), player.getBukkitEntity()).callEvent();
++ }
++ // Paper end
+ }
+ // Paper end - rewrite player chunk loader
+
+@@ -89,6 +94,11 @@ public class PlayerChunkSender {
+ final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk);
+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null, shouldModify));
+ // Paper end - Anti-Xray
++ // Paper start - PlayerChunkLoadEvent
++ if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
++ new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent();
++ }
++ // Paper end - PlayerChunkLoadEvent
+ ChunkPos chunkPos = chunk.getPos();
+ DebugPackets.sendPoiPacketsForChunk(world, chunkPos);
+ }