diff --git a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch index 7a827cb0798c..fee8262c8304 100644 --- a/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch +++ b/paper-server/patches/sources/net/minecraft/server/level/ChunkMap.java.patch @@ -1,5 +1,21 @@ --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java +@@ -58,6 +_,7 @@ + import net.minecraft.network.protocol.game.ClientGamePacketListener; + import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket; + import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; ++import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; + import net.minecraft.resources.Identifier; + import net.minecraft.resources.ResourceKey; + import net.minecraft.server.network.ServerPlayerConnection; +@@ -73,6 +_,7 @@ + import net.minecraft.util.thread.ConsecutiveExecutor; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.Leashable; + import net.minecraft.world.entity.UpdateInterval; + import net.minecraft.world.entity.ai.village.poi.PoiManager; + import net.minecraft.world.entity.boss.enderdragon.EnderDragonPart; @@ -151,6 +_,33 @@ public int serverViewDistance; private final WorldGenContext worldGenContext; @@ -311,7 +327,7 @@ if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); if (this.seenBy.isEmpty()) { -@@ -1382,23 +_,47 @@ +@@ -1382,23 +_,52 @@ } public void updatePlayer(final ServerPlayer player) { @@ -352,6 +368,11 @@ + // Paper start - entity tracking events + if (io.papermc.paper.event.player.PlayerTrackEntityEvent.getHandlerList().getRegisteredListeners().length == 0 || new io.papermc.paper.event.player.PlayerTrackEntityEvent(player.getBukkitEntity(), this.entity.getBukkitEntity()).callEvent()) { this.serverEntity.addPairing(player); ++ // Paper start - Resend leashes when the holder starts being tracked ++ for (Leashable leashed : Leashable.leashableLeashedTo(this.entity)) { ++ player.connection.send(new ClientboundSetEntityLinkPacket((Entity) leashed, this.entity)); ++ } ++ // Paper end - Resend leashes when the holder starts being tracked if (this.seenBy.size() == 1) { ChunkMap.this.level.debugSynchronizers().registerEntity(this.entity); }