From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Tue, 16 Feb 2021 00:16:56 -0800
Subject: [PATCH] Send full pos packets for hard colliding entities

Prevent collision problems due to desync (i.e boats)

Configurable under
`send-full-pos-for-hard-colliding-entities`

diff --git a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
index ceeb515f4528551659598d9999917f8596e3eded..0959aa6855a150b121b9b75885216c46b151179e 100644
--- a/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
+++ b/src/main/java/com/tuinity/tuinity/config/TuinityConfig.java
@@ -229,6 +229,12 @@ public final class TuinityConfig {
         useNewLightEngine = TuinityConfig.getBoolean("use-new-light-engine", true);
     }
 
+    public static boolean sendFullPosForHardCollidingEntities;
+
+    private static void sendFullPosForHardCollidingEntities() {
+        sendFullPosForHardCollidingEntities = TuinityConfig.getBoolean("send-full-pos-for-hard-colliding-entities", true);
+    }
+
     public static final class WorldConfig {
 
         public final String worldName;
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 798ebfdcd8e06ffb576964da006e77bd188ad274..2402c18e6a18221a43bea9fc68278da9d19eede4 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -157,7 +157,7 @@ public class EntityTrackerEntry {
                     // Paper end - remove allocation of Vec3D here
                     boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
 
-                    if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround()) {
+                    if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround() && !(com.tuinity.tuinity.config.TuinityConfig.sendFullPosForHardCollidingEntities && this.tracker.hardCollides())) { // Tuinity - send full pos for hard colliding entities to prevent collision problems due to desync
                         if ((!flag2 || !flag3) && !(this.tracker instanceof EntityArrow)) {
                             if (flag2) {
                                 packet1 = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.tracker.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.tracker.isOnGround());
