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/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index bbb3f88bb15c70aec7f4d223dd3c0cc986c6eb21..b8fa8a582c4e440990f7e9c426c40bb576a3af66 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -392,6 +392,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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 691f3354637f84d0a5b2a0c1c0f493f7de3b61af..1c00f28ff41e236f684a055928c54069719ab2ac 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2042,7 +2042,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.datawatcher, true)); + // Paper start - update entity for all players + PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true); + if (entity.tracker != null) { + entity.tracker.broadcast(packet); + } else { + this.sendPacket(packet); + } + // Paper end } if (event.isCancelled()) {