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 c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13..d89d53e9990918fb9863a7eed3111ef026c95386 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -393,6 +393,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 454587fc85aecad21f4f042dd87c35a4232338e9..fa6ae287036992bc91c56c96fadb331050ebfbc3 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -2146,7 +2146,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()) {