mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Use a method for EntityTrackerEntry for Gerrygames
Allow overriding the method for interception https://github.com/PaperMC/Paper/issues/1537 Resolves #1537
This commit is contained in:
parent
f0ade197ea
commit
3c30cc1600
3 changed files with 12 additions and 5 deletions
|
@ -19,7 +19,7 @@ index 1474209a1e..5e5c241669 100644
|
||||||
if (bukkitEntity == null) {
|
if (bukkitEntity == null) {
|
||||||
bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
|
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
|
||||||
|
|
|
@ -30,7 +30,7 @@ index 6c4c192446..ad9e7f7b54 100644
|
||||||
ItemStack itemstack1 = this.a(entityitem);
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
|
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
|
||||||
|
|
|
@ -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
|
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
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||||
@@ -0,0 +0,0 @@ public class EntityTrackerEntry {
|
@@ -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.
|
+ // their first update (which is forced to have absolute coordinates), false afterward.
|
||||||
+ public java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = new java.util.HashMap<EntityPlayer, Boolean>();
|
+ public java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = new java.util.HashMap<EntityPlayer, Boolean>();
|
||||||
+ public Set<EntityPlayer> trackedPlayers = trackedPlayerMap.keySet();
|
+ public Set<EntityPlayer> 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
|
+ // Paper end
|
||||||
|
|
||||||
public EntityTrackerEntry(Entity entity, int i, int j, int k, boolean flag) {
|
public EntityTrackerEntry(Entity entity, int i, int j, int k, boolean flag) {
|
||||||
|
@ -56,9 +63,9 @@ index 0410f9cf3..6ae576a2e 100644
|
||||||
+ if (teleportPacket == null) {
|
+ if (teleportPacket == null) {
|
||||||
+ teleportPacket = new PacketPlayOutEntityTeleport(this.tracker);
|
+ teleportPacket = new PacketPlayOutEntityTeleport(this.tracker);
|
||||||
+ }
|
+ }
|
||||||
+ viewer.getKey().playerConnection.sendPacket(teleportPacket);
|
+ sendPlayerPacket(viewer.getKey(), teleportPacket);
|
||||||
+ } else {
|
+ } else {
|
||||||
+ viewer.getKey().playerConnection.sendPacket((Packet) object);
|
+ sendPlayerPacket(viewer.getKey(), (Packet) object);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
Loading…
Reference in a new issue