Don't mutate the position of Items for MC-4 Fix (#12702)

This commit is contained in:
Owen
2025-06-25 15:51:26 -04:00
committed by GitHub
parent 692e93a91f
commit ea10fa4a79
5 changed files with 19 additions and 24 deletions

View File

@@ -1786,7 +1786,7 @@
}
public void addDeltaMovement(Vec3 addend) {
@@ -3661,9 +_,45 @@
@@ -3661,9 +_,35 @@
return this.getZ((2.0 * this.random.nextDouble() - 1.0) * scale);
}
@@ -1815,16 +1815,6 @@
+ 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 VecDeltaCodec todo computation changed?
+ 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) {
+ synchronized (this.posLock) { // Paper - detailed watchdog information
this.position = new Vec3(x, y, z);