2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-03-24 17:00:42 +00:00
|
|
|
From: AgentTroll <woodyc40@gmail.com>
|
|
|
|
Date: Fri, 22 Mar 2019 22:24:03 -0700
|
2019-03-24 21:48:22 +00:00
|
|
|
Subject: [PATCH] Update entity Metadata for all tracked players
|
2019-03-24 17:00:42 +00:00
|
|
|
|
|
|
|
|
2019-05-06 00:57:14 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
2020-08-25 02:22:08 +00:00
|
|
|
index bbb3f88bb15c70aec7f4d223dd3c0cc986c6eb21..b8fa8a582c4e440990f7e9c426c40bb576a3af66 100644
|
2019-05-06 00:57:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
2020-06-25 14:09:55 +00:00
|
|
|
@@ -392,6 +392,12 @@ public class EntityTrackerEntry {
|
2019-05-06 00:57:14 +00:00
|
|
|
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) {
|
2019-03-24 17:00:42 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2020-08-29 04:17:19 +00:00
|
|
|
index 18ea59a5b9bb3720696fc8732f9eab19674e8ddf..46329ecc93ba30c9af909d74215a5c7e26aa1abe 100644
|
2019-03-24 17:00:42 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2020-08-29 04:17:19 +00:00
|
|
|
@@ -2036,7 +2036,14 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
2019-03-24 17:00:42 +00:00
|
|
|
|
|
|
|
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));
|
2020-04-27 05:57:42 +00:00
|
|
|
+ // 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
|
2019-03-24 17:00:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (event.isCancelled()) {
|