3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0338-Update-entity-Metadata-for-all-tracked-players.patch
Riley Park 9907cedecb
New chat events for better Adventure support (#5289)
Bump Adventure to 4.6.0

fixes #5216
fixes #5261
fixes #5287
2021-03-01 19:07:12 -08:00

44 Zeilen
2.3 KiB
Diff

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/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13..d89d53e9990918fb9863a7eed3111ef026c95386 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -393,6 +393,12 @@ public class EntityTrackerEntry {
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
index fb98cfecbcf4c7773cd9fde37a6614ced107e07a..95c5f956055d43ee0aeb291ad8f66cadf7a6d507 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -2141,7 +2141,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()) {