Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-14 20:10:05 +01:00
c6aa61ee18
Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b9df8e9f SPIGOT-7933: Improve custom Minecart max speed fc496179 Fix InstrumentTest 7c0ec598 PR-1075: Make Art an interface c389f5a4 PR-1074: Make Sound an interface CraftBukkit Changes: df1efc0bb SPIGOT-7945: `Bukkit#dispatchCommand` throws `UnsupportedOperationException` 285df6e85 SPIGOT-7933: Improve custom Minecart max speed a0f3d4e50 SPIGOT-7940: Recipe book errors after reload 9e0618ec2 SPIGOT-7937: Cannot spawn minecart during world generation with minecart_improvements enabled 1eb4d28da SPIGOT-7941: Fix resistance over 4 amplify causing issues in damage 52b99158a PR-1504: Make Art an interface e18ae35f1 PR-1502: Make Sound an interface Spigot Changes: e65d67a7 SPIGOT-7934: Item entities start "bouncing" under certain conditions
51 Zeilen
2.5 KiB
Diff
51 Zeilen
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
|
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.
|
|
|
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
|
|
index 488ebd443903af812913437f1ade3002093f2470..a043ac10834562d357ef0b5aded2e916e2a0d056 100644
|
|
--- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
|
|
+++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
|
|
@@ -9,12 +9,12 @@ public class VecDeltaCodec {
|
|
|
|
@VisibleForTesting
|
|
static long encode(double value) {
|
|
- return Math.round(value * 4096.0);
|
|
+ return Math.round(value * 4096.0); // Paper - Fix MC-4; diff on change
|
|
}
|
|
|
|
@VisibleForTesting
|
|
static double decode(long value) {
|
|
- return (double)value / 4096.0;
|
|
+ return value / 4096.0; // Paper - Fix MC-4; diff on change
|
|
}
|
|
|
|
public Vec3 decode(long x, long y, long z) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 9ebce90de425989014466d2c5ce68fce505d1dcd..282863951033f7e036b0e58393651e1a22fada23 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4479,6 +4479,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
return;
|
|
}
|
|
// Paper end - Block invalid positions and bounding box
|
|
+ // Paper start - Fix MC-4
|
|
+ if (this instanceof ItemEntity) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) {
|
|
+ // encode/decode from ClientboundMoveEntityPacket
|
|
+ x = Mth.lfloor(x * 4096.0) * (1 / 4096.0);
|
|
+ y = Mth.lfloor(y * 4096.0) * (1 / 4096.0);
|
|
+ z = Mth.lfloor(z * 4096.0) * (1 / 4096.0);
|
|
+ }
|
|
+ }
|
|
+ // Paper end - Fix MC-4
|
|
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
|
this.position = new Vec3(x, y, z);
|
|
int i = Mth.floor(x);
|