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 3ff7a7b4a853068eba2fb034246a58116a846523..3a88c9a67062eb73ad8257ea786efca7e7e99f65 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -387,6 +387,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 dca5e1363a8a850a8363cccab360109bd359aea5..de742d6a8c0a28d524850288eb4e2e548237d61e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2007,7 +2007,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()) {