9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-22 08:29:24 +00:00
Files
SparklyPaperMC/patches/server/0025-Only-attempt-to-resync-display-entities-position-whe.patch
MrPowerGamerBR dcdb966994 Only attempt to resync display entities' position when it has actually changed to fix teleport interpolation issues
On display entities, any new Pos/Rot packet causes the teleport duration interpolation to reset

While this does not cause issues when you spawn a display entity -> set the interpolation -> teleport after the data has been sent to the client, this DOES cause issues on entities that have lived for >60 ticks, where if you spawn a display with interpolation -> wait ~8 ticks -> teleport it, the end of the teleport will look slow due to the server resyncing the display entity position/rotation
2024-12-01 01:24:33 -03:00

28 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
Date: Sun, 1 Dec 2024 01:12:50 -0300
Subject: [PATCH] Only attempt to resync display entities' position when it has
actually changed to fix teleport interpolation issues
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index ff5bf212e194dd0914c06e636a8268e8e8f6fff8..b09664593f6fc2392e2943cb84dbaee19e7f6d93 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -221,6 +221,7 @@ public class ServerEntity {
if (!this.forceStateResync && !flag5 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()) { // Paper - fix desync when a player is added to the tracker
if ((!flag2 || !flag) && !(this.entity instanceof AbstractArrow)) {
+ if (!(this.entity instanceof net.minecraft.world.entity.Display) || (flag || flag1)) { // SparklyPaper start - Only attempt to resync display entities' position when it has actually changed to fix teleport interpolation issues
if (flag2) {
packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) i), (short) ((int) j), (short) ((int) k), this.entity.onGround());
flag3 = true;
@@ -228,6 +229,7 @@ public class ServerEntity {
packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), b0, b1, this.entity.onGround());
flag4 = true;
}
+ } // SparklyPaper end
} else {
packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) i), (short) ((int) j), (short) ((int) k), b0, b1, this.entity.onGround());
flag3 = true;