aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0306-Update-entity-Metadata-for-all-tracked-players.patch
blob: ee43d26bb33b38b89ee1b20b80234579cae7cfc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 0000000000000000000000000000000000000000 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/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index d6f34adbdf45bbef4a39e629dd7cb6d7fcb5db0f..7881176a900daa3306c691454f688c1f79b73475 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -371,6 +371,12 @@ public class ServerEntity {
 
     }
 
+    // Paper start - Add broadcast method
+    void broadcast(Packet<?> packet) {
+        this.broadcast.accept(packet);
+    }
+    // Paper end
+
     private void broadcastAndSend(Packet<?> packet) {
         this.broadcast.accept(packet);
         if (this.entity instanceof ServerPlayer) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 933d74f48dfedc15eec76b4e376e51c40bc4bea5..90af6b5e7f6188eec4a4e311a0d273857d3d1c5c 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2727,7 +2727,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
 
                         if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) {
                             // Refresh the current entity metadata
-                            ServerGamePacketListenerImpl.this.send(new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true));
+                            // Paper start - update entity for all players
+                            ClientboundSetEntityDataPacket packet1 = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true);
+                            if (entity.tracker != null) {
+                                entity.tracker.broadcast(packet1);
+                            } else {
+                                ServerGamePacketListenerImpl.this.send(packet1);
+                            }
+                            // Paper end
                         }
 
                         if (event.isCancelled()) {