Don't double broadcast movement packets (fixes #1784)

WROOOONG LEEEVERRR....
This commit is contained in:
Shane Freeder 2019-01-02 16:39:33 +00:00
parent 9af685abe7
commit 5d5e0ad75c
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
2 changed files with 10 additions and 9 deletions

View File

@ -1,11 +1,11 @@
From 99e8159915dbca4b04eac59a3ebe3cb845b70f15 Mon Sep 17 00:00:00 2001
From 027d9ba0aeedf51baf08e9b0c824b80098818a7f Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Wed, 2 Mar 2016 23:13:07 -0600
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 dd6c84b4a..a12a42c32 100644
index dd6c84b4a..de0cf6b73 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -41,7 +41,19 @@ public class EntityTrackerEntry {
@ -45,10 +45,11 @@ index dd6c84b4a..a12a42c32 100644
if (l1 >= -32768L && l1 < 32768L && i2 >= -32768L && i2 < 32768L && j2 >= -32768L && j2 < 32768L && this.v <= 400 && !this.x && this.y == this.tracker.onGround) {
if ((!flag1 || !flag2) && !(this.tracker instanceof EntityArrow)) {
if (flag1) {
@@ -202,6 +214,26 @@ public class EntityTrackerEntry {
@@ -201,7 +213,26 @@ public class EntityTrackerEntry {
}
if (packet1 != null) {
this.broadcast((Packet) packet1);
- this.broadcast((Packet) packet1);
+ // Paper start - ensure fresh viewers get an absolute position on their first update,
+ // since we can't be certain what position they received in the spawn packet.
+ if (packet1 instanceof PacketPlayOutEntityTeleport) {
@ -72,7 +73,7 @@ index dd6c84b4a..a12a42c32 100644
}
this.d();
@@ -338,7 +370,7 @@ public class EntityTrackerEntry {
@@ -338,7 +369,7 @@ public class EntityTrackerEntry {
entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
// CraftBukkit end

View File

@ -1,4 +1,4 @@
From 50cda9c60ae28cd18ad98fc7c6939974b7fec251 Mon Sep 17 00:00:00 2001
From 2e18b9af25006981e797eb0e9a1347ab4abf5050 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 17 Jun 2013 01:24:00 -0400
Subject: [PATCH] Entity Tracking Improvements
@ -19,7 +19,7 @@ index b6356966a..583cee415 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 638b54c1e..28a0ea034 100644
index b3aa57d19..2b8501143 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -56,6 +56,7 @@ public class EntityTrackerEntry {
@ -30,7 +30,7 @@ index 638b54c1e..28a0ea034 100644
this.tracker = entity;
this.e = i;
this.f = j;
@@ -454,17 +455,59 @@ public class EntityTrackerEntry {
@@ -453,17 +454,59 @@ public class EntityTrackerEntry {
this.tracker.b(entityplayer);
entityplayer.d(this.tracker);
@ -90,7 +90,7 @@ index 638b54c1e..28a0ea034 100644
double d0 = entityplayer.locX - (double) this.xLoc / 4096.0D;
double d1 = entityplayer.locZ - (double) this.zLoc / 4096.0D;
int i = Math.min(this.e, (entityplayer.getViewDistance() - 1) * 16); // Paper - Use player view distance API
@@ -605,6 +648,7 @@ public class EntityTrackerEntry {
@@ -604,6 +647,7 @@ public class EntityTrackerEntry {
this.trackedPlayers.remove(entityplayer);
this.tracker.c(entityplayer);
entityplayer.c(this.tracker);