From 3c30cc1600c9829168b3f9f41eac683f0892e0e8 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 10 Oct 2018 23:18:02 -0400 Subject: [PATCH] Use a method for EntityTrackerEntry for Gerrygames Allow overriding the method for interception https://github.com/PaperMC/Paper/issues/1537 Resolves #1537 --- .../Entity-Tracking-Improvements.patch | 2 +- ...ps-in-item-frames-performance-and-bug-fixe.patch | 2 +- ...ute-position-the-first-time-an-entity-is-s.patch | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Spigot-Server-Patches/Entity-Tracking-Improvements.patch b/Spigot-Server-Patches/Entity-Tracking-Improvements.patch index 826aa1cc82..e22bcb7865 100644 --- a/Spigot-Server-Patches/Entity-Tracking-Improvements.patch +++ b/Spigot-Server-Patches/Entity-Tracking-Improvements.patch @@ -19,7 +19,7 @@ index 1474209a1e..5e5c241669 100644 if (bukkitEntity == null) { bukkitEntity = CraftEntity.getEntity(world.getServer(), this); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 6120c63a38..a9d51641c1 100644 +index 69d3b4f8e4..0b00ed3d00 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { diff --git a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 6c73ba2a49..7896101fe9 100644 --- a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -30,7 +30,7 @@ index 6c4c192446..ad9e7f7b54 100644 ItemStack itemstack1 = this.a(entityitem); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 5c75d494a2..6120c63a38 100644 +index a049b8d68e..69d3b4f8e4 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { diff --git a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch index 7b30f06721..c3405593cb 100644 --- a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Send absolute position the first time an entity is seen diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0410f9cf3..6ae576a2e 100644 +index 5dbd493f41..a049b8d68e 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { @@ -18,6 +18,13 @@ index 0410f9cf3..6ae576a2e 100644 + // their first update (which is forced to have absolute coordinates), false afterward. + public java.util.Map trackedPlayerMap = new java.util.HashMap(); + public Set trackedPlayers = trackedPlayerMap.keySet(); ++ ++ /** ++ * Requested in https://github.com/PaperMC/Paper/issues/1537 to allow intercepting packets ++ */ ++ public void sendPlayerPacket(EntityPlayer player, Packet packet) { ++ player.playerConnection.sendPacket(packet); ++ } + // Paper end public EntityTrackerEntry(Entity entity, int i, int j, int k, boolean flag) { @@ -56,9 +63,9 @@ index 0410f9cf3..6ae576a2e 100644 + if (teleportPacket == null) { + teleportPacket = new PacketPlayOutEntityTeleport(this.tracker); + } -+ viewer.getKey().playerConnection.sendPacket(teleportPacket); ++ sendPlayerPacket(viewer.getKey(), teleportPacket); + } else { -+ viewer.getKey().playerConnection.sendPacket((Packet) object); ++ sendPlayerPacket(viewer.getKey(), (Packet) object); + } + } + }