aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch')
-rw-r--r--patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch
new file mode 100644
index 0000000000..ab0862ea30
--- /dev/null
+++ b/patches/server/0315-Update-entity-Metadata-for-all-tracked-players.patch
@@ -0,0 +1,43 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: AgentTroll <[email protected]>
+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 3d27cbf5e9105def2f38525a85da5acf8ebf8fe9..ceba19ea3bb9664899b83f82f28af06476b7ff56 100644
+--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
++++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
+@@ -391,6 +391,12 @@ public class ServerEntity {
+ return ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp);
+ }
+
++ // 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 8585cc9441674950dc8646f12698fb356cfc9e96..e3d0180fc1219cfb33cfc3b55a127f86fa23618a 100644
+--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+@@ -2287,7 +2287,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
+
+ 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()) {