geforkt von Mirrors/Paper
bb4002d82e
Use a proper teleport for teleporting to entities in different worlds. Validate that the target entity is valid and deny spectate requests from frozen players. Also, make sure the entity is spawned to the client before sending the camera packet. If the entity isn't spawned clientside when it receives the camera packet, then the client will not spectate the target entity.
44 Zeilen
2.3 KiB
Diff
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 3ff7a7b4a853068eba2fb034246a58116a846523..3a88c9a67062eb73ad8257ea786efca7e7e99f65 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -387,6 +387,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 dca5e1363a8a850a8363cccab360109bd359aea5..de742d6a8c0a28d524850288eb4e2e548237d61e 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -2007,7 +2007,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()) {
|