mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
046466f3ba
* Re-arrange most chunk system patches to front Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
44 lines
2.8 KiB
Diff
44 lines
2.8 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/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 db3b208e560ae2c8a59bfb474f7b2266d108068f..75cd936e28c3c933c53513093634a9d071a7f94b 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2730,7 +2730,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 entityDataPacket = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true);
|
|
+ if (entity.tracker != null) {
|
|
+ entity.tracker.broadcast(entityDataPacket);
|
|
+ } else {
|
|
+ ServerGamePacketListenerImpl.this.send(entityDataPacket);
|
|
+ }
|
|
+ // Paper end
|
|
// SPIGOT-7136 - Allays
|
|
if (entity instanceof Allay) {
|
|
ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|