diff options
author | Spottedleaf <[email protected]> | 2024-07-11 08:15:36 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-07-11 08:15:36 -0700 |
commit | 8b558d9e0b5164dd93421624a3ce5c7f3dfb8fa6 (patch) | |
tree | 45b9db095f8ec129d74caec4d7eb8563acddea50 | |
parent | f7124df56b0c71b567b67dcffc66dae1cac181ad (diff) | |
download | Paper-8b558d9e0b5164dd93421624a3ce5c7f3dfb8fa6.tar.gz Paper-8b558d9e0b5164dd93421624a3ce5c7f3dfb8fa6.zip |
Apply entity tracker desync patch
-rw-r--r-- | patches/server/1037-Fix-entity-tracker-desync-when-new-players-are-added.patch (renamed from patches/unapplied/server/1042-Fix-entity-tracker-desync-when-new-players-are-added.patch) | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/patches/unapplied/server/1042-Fix-entity-tracker-desync-when-new-players-are-added.patch b/patches/server/1037-Fix-entity-tracker-desync-when-new-players-are-added.patch index a39b2bf46f..b4b1053293 100644 --- a/patches/unapplied/server/1042-Fix-entity-tracker-desync-when-new-players-are-added.patch +++ b/patches/server/1037-Fix-entity-tracker-desync-when-new-players-are-added.patch @@ -21,10 +21,10 @@ added to the tracker is just easier to do, so that is what this patch does. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index dbe9df1e1973db133f7c8516256697ef7c968137..7fb9ba3dadb1eca4a1000ea8cf4d13fed2b7db1e 100644 +index c96740a82eac9101f74edeb44edf4b64d1d633e0..8b6754525fafd1aaac3292cf69a855d6a42b9523 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1450,6 +1450,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1189,6 +1189,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.serverEntity.addPairing(player); } // Paper end - entity tracking events @@ -33,10 +33,10 @@ index dbe9df1e1973db133f7c8516256697ef7c968137..7fb9ba3dadb1eca4a1000ea8cf4d13fe } else if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 4f103f731623a8570238a6867fda1c5f83fca4e4..f16a69775332a08ed0e87d27acd0fc959359694c 100644 +index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..b4971813d267dffc6507502345e5c8b991541eca 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -97,6 +97,13 @@ public class ServerEntity { +@@ -96,6 +96,13 @@ public class ServerEntity { this.trackedDataValues = entity.getEntityData().getNonDefaultValues(); } @@ -50,7 +50,7 @@ index 4f103f731623a8570238a6867fda1c5f83fca4e4..f16a69775332a08ed0e87d27acd0fc95 public void sendChanges() { List<Entity> list = this.entity.getPassengers(); -@@ -141,7 +148,7 @@ public class ServerEntity { +@@ -140,7 +147,7 @@ public class ServerEntity { } } @@ -59,23 +59,16 @@ index 4f103f731623a8570238a6867fda1c5f83fca4e4..f16a69775332a08ed0e87d27acd0fc95 int i; int j; -@@ -177,13 +184,13 @@ public class ServerEntity { - boolean flag4 = false; - boolean flag5 = false; +@@ -180,7 +187,7 @@ public class ServerEntity { + long i1 = this.positionCodec.encodeZ(vec3d); + boolean flag6 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; -- if (!(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position to fix first-tick teleports -+ if (this.forceStateResync || !(this.entity instanceof net.minecraft.world.entity.decoration.HangingEntity) || this.tickCount > 0 || this.entity instanceof AbstractArrow) { // Paper - Always update position to fix first-tick teleports - long k = this.positionCodec.encodeX(vec3d); - long l = this.positionCodec.encodeY(vec3d); - long i1 = this.positionCodec.encodeZ(vec3d); - boolean flag6 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; - -- if (!flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync -+ if (!this.forceStateResync && !flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync - if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) { - if (flag2) { - packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround()); -@@ -240,6 +247,7 @@ public class ServerEntity { +- if (!flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()) { ++ if (!this.forceStateResync && !flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()) { // Paper - fix desync when a player is added to the tracker + if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) { + if (flag2) { + packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround()); +@@ -244,6 +251,7 @@ public class ServerEntity { } this.entity.hasImpulse = false; |