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
|
|
|
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
2021-04-04 07:22:27 +00:00
|
|
|
index e3cdea3c85d762af6984f3dbe544fdfe101f6ff6..6110d7723b70df5380338a42b5cbff3446294bac 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
2021-04-04 07:22:27 +00:00
|
|
|
@@ -421,6 +421,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) {
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
2021-04-18 09:02:48 +00:00
|
|
|
index 2c949e079e5de86c902b162dfdb6adffe0511448..02ae07db49d3793c0cc40ebe55cdc6b383f9b2e3 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
2021-04-18 09:02:48 +00:00
|
|
|
@@ -2287,7 +2287,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
|
2021-03-16 07:19:45 +00:00
|
|
|
- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true));
|
2020-04-27 05:57:42 +00:00
|
|
|
+ // Paper start - update entity for all players
|
2021-03-16 13:04:28 +00:00
|
|
|
+ PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true);
|
2020-04-27 05:57:42 +00:00
|
|
|
+ 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()) {
|