testserver/Spigot-Server-Patches/0346-Update-entity-Metadata...

44 lines
2.3 KiB
Diff
Raw Normal View History

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
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-06-25 14:09:55 +00:00
index b5a76f37c27cde25b2561a23c7c0fe7bdd992fee..9b89c0c8a3f1dada4e9b2aaeed0b92e56229b7ca 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) {
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
2020-06-25 14:09:55 +00:00
index 0296dfc4e944de9156715c93a33b699c2d7cf63a..4a718ab0cccef1eef2bcf6fdc5942ba820858dc1 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2020-06-25 14:09:55 +00:00
@@ -2045,7 +2045,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));
+ // 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()) {