From fd1bd5223a461b6d98280bb8f2d67280a30dd24a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 21 Sep 2018 11:37:38 -0400
Subject: [PATCH] Sync Player Position to Vehicles

Player Positions could become desynced with their vehicle resulting
in chunk conflicts about which chunk the entity should really be in.
---
 ...378-Sync-Player-Position-to-Vehicles.patch | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch

diff --git a/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch b/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
new file mode 100644
index 0000000000..75746cad5f
--- /dev/null
+++ b/Spigot-Server-Patches/0378-Sync-Player-Position-to-Vehicles.patch
@@ -0,0 +1,38 @@
+From 140555c5ff6e1b08831fdaf59c74297ee0234102 Mon Sep 17 00:00:00 2001
+From: Aikar <aikar@aikar.co>
+Date: Fri, 21 Sep 2018 11:34:00 -0400
+Subject: [PATCH] Sync Player Position to Vehicles
+
+Player Positions could become desynced with their vehicle resulting
+in chunk conflicts about which chunk the entity should really be in.
+
+diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
+index 452c279708..e7a2df685d 100644
+--- a/src/main/java/net/minecraft/server/PlayerConnection.java
++++ b/src/main/java/net/minecraft/server/PlayerConnection.java
+@@ -375,10 +375,13 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
+                 }
+ 
+                 entity.setLocation(d3, d4, d5, f, f1);
++                Location curPos = getPlayer().getLocation(); // Paper
++                player.setLocation(d3, d4, d5, f, f1); // Paper
+                 boolean flag2 = worldserver.getCubes(entity, entity.getBoundingBox().shrink(0.0625D));
+ 
+                 if (flag && (flag1 || !flag2)) {
+                     entity.setLocation(d0, d1, d2, f, f1);
++                    player.setLocation(d0, d1, d2, f, f1); // Paper
+                     this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
+                     return;
+                 }
+@@ -388,7 +391,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
+                 // Spigot Start
+                 if ( !hasMoved )
+                 {
+-                    Location curPos = player.getLocation();
++                    //Location curPos = player.getLocation(); // Paper - move up
+                     lastPosX = curPos.getX();
+                     lastPosY = curPos.getY();
+                     lastPosZ = curPos.getZ();
+-- 
+2.19.0
+