revert last commit

This commit is contained in:
Lulu13022002 2023-06-01 13:32:45 +02:00
parent a60a3a41b8
commit 4c1afdb978
No known key found for this signature in database
GPG Key ID: 491C8F0B8ACDEB01

View File

@ -12,12 +12,13 @@ and doesn't solve the stats issue.
In this patch i have at least mitigated the rider Y offset but
that will not always works for some action/entity like the horse jump
etc...
But this patch prevent the teleportation that upstream
do to sync the rider with its vehicle and
prevent further desync when the final location is modified
This patch also prevent the teleportation that upstream
do to sync the rider with its vehicle, thus the
movement statistics of the player will not increase
without any real move.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index aa287d7f37f38d938d195114408cb6dbda59063d..a4cfc91ebeb4b19f08ee384c3e01902f0fea9c88 100644
index aa287d7f37f38d938d195114408cb6dbda59063d..c53115187cb08b20566802422457d49973da290f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -689,7 +689,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@ -56,7 +57,7 @@ index aa287d7f37f38d938d195114408cb6dbda59063d..a4cfc91ebeb4b19f08ee384c3e01902f
to.setZ(packet.getZ());
@@ -747,12 +747,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -747,6 +747,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Skip the first time we do this
if (true) { // Spigot - don't skip any move events
Location oldTo = to.clone();
@ -64,30 +65,7 @@ index aa287d7f37f38d938d195114408cb6dbda59063d..a4cfc91ebeb4b19f08ee384c3e01902f
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
// If the event is cancelled we move the player back to their old location.
if (event.isCancelled()) {
- this.teleport(from);
+ // Paper start - handle correctly the cancellation
+ this.awaitingPositionFromClient = null;
+ entity.absMoveTo(d0, d1, d2, f, f1);
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
+ // Paper end
return;
}
@@ -760,13 +765,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// there to avoid any 'Moved wrongly' or 'Moved too quickly' errors.
// We only do this if the Event was not cancelled.
if (!oldTo.equals(event.getTo()) && !event.isCancelled()) {
- this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.PLUGIN);
+ // Paper start
+ this.awaitingPositionFromClient = null;
+ Location finalLoc = event.getTo();
+ entity.absMoveTo(finalLoc.getX(), finalLoc.getY(), finalLoc.getZ(), finalLoc.getYaw(), finalLoc.getPitch());
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
+ // Paper end
return;
}
@@ -766,7 +767,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// Check to see if the Players Location has some how changed during the call of the event.
// This can happen due to a plugin teleporting the player instead of using .setTo()