From e125c7ff12061fed58acfea1cc553d4f65eac5b3 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 27 Apr 2020 01:57:42 -0400 Subject: [PATCH] null check tracker for entity metadata update - Fixes #3070 --- ...te-entity-Metadata-for-all-tracked-players.patch | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch b/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch index 17f63c5e0c..ca71a0d455 100644 --- a/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch +++ b/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch @@ -5,7 +5,7 @@ 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 3ff7a7b4..3a88c9a6 100644 +index 3ff7a7b4a8..3a88c9a670 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { @@ -22,7 +22,7 @@ index 3ff7a7b4..3a88c9a6 100644 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 94d3d602..eee96c3a 100644 +index 94d3d602cc..f496006f3c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -30,7 +30,14 @@ index 94d3d602..eee96c3a 100644 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)); -+ entity.tracker.broadcast(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); // Paper - update entity for all players ++ // 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()) {