null check tracker for entity metadata update - Fixes #3070

This commit is contained in:
Aikar 2020-04-27 01:57:42 -04:00
parent fdf41b742d
commit fe366fbe77
No known key found for this signature in database
GPG key ID: 401ADFC9891FAAFE

View file

@ -1,11 +1,11 @@
From 4526182f1a02ee548d2f7fa856a0ce04fdb81d0c Mon Sep 17 00:00:00 2001
From dd6dba897fb9a1838363f2bd89da221a9f6ae91b Mon Sep 17 00:00:00 2001
From: AgentTroll <woodyc40@gmail.com>
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 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
@@ -387,6 +387,12 @@ public class EntityTrackerEntry {
@ -22,18 +22,25 @@ 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
@@ -2006,7 +2006,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@@ -2006,7 +2006,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));
+ 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()) {
--
2.25.1.windows.1
2.26.2