From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AgentTroll Date: Fri, 22 Mar 2019 22:24:03 -0700 Subject: [PATCH] Update entity Metadata for all tracked players diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index e3cdea3c85d762af6984f3dbe544fdfe101f6ff6..6110d7723b70df5380338a42b5cbff3446294bac 100644 --- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java @@ -421,6 +421,12 @@ public class EntityTrackerEntry { return PacketPlayOutEntity.a(this.xLoc, this.yLoc, this.zLoc); } + // Paper start - Add broadcast method + void broadcast(Packet packet) { + this.getPacketConsumer().accept(packet); + } + // Paper end + private void broadcastIncludingSelf(Packet packet) { this.f.accept(packet); if (this.tracker instanceof EntityPlayer) { diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index c0c9af81a933135e940587c10155a24cd399b922..d279c5673f1daf34914203ade0e893ea994fc607 100644 --- a/src/main/java/net/minecraft/server/network/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -2288,7 +2288,14 @@ public class PlayerConnection implements PacketListenerPlayIn { if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { // Refresh the current entity metadata - this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true)); + // Paper start - update entity for all players + PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true); + if (entity.tracker != null) { + entity.tracker.broadcast(packet); + } else { + this.sendPacket(packet); + } + // Paper end } if (event.isCancelled()) {