From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Tue, 8 Dec 2020 20:24:52 -0600 Subject: [PATCH] MC-4: Fix item position desync This fixes item position desync (MC-4) by running the item coordinates through the encode/decode methods of the packet that causes the precision loss, which forces the server to lose the same precision as the client keeping them in sync. 1.19: entity tracking position changes diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java index ccc60a5465efa2b71fc2593d75af62c0b64fe66c..1adbceadd5df96e17796561a40eb7b760493440e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -101,6 +101,11 @@ public class PaperConfig { trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false); } + public static boolean fixEntityPositionDesync = true; + private static void fixEntityPositionDesync() { + fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync); + } + public static void registerCommands() { for (Map.Entry entry : commands.entrySet()) { MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f900d72dab 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java @@ -21,11 +21,11 @@ public abstract class ClientboundMoveEntityPacket implements Packet