geforkt von Mirrors/Paper
789bc79280
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: c9a46ebf #653: Add World#spawn with randomizeData parameter e49c2e3a Damageable should extend ItemMeta 01ff04f4 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API ca5b4b1a SPIGOT-6697: Deprecate generateTree with BlockChangeDelegate as it does not handle tiles CraftBukkit Changes: 7c8bbcbe SPIGOT-6716: Preserve the order of stored enchantments of enchanted books. 18027d02 #914: Add World#spawn with randomizeData parameter 3cad0316 SPIGOT-6714: Don't fire PlayerBucketEvent when empty 8c6d60cf Fix server crash with BlockPopulator when entities are at a negative chunk border 4f6bcc84 SPIGOT-5880, SPIGOT-5567: New ChunkGenerator API 78d5b35b SPIGOT-6697: Restore generateTree with BlockChangeDelegate behaviour 15792f0d Rebuild patch c949675e SPIGOT-6713: Cancelling EntityTransformEvent Causes Deceased Slimes To Not Despawn a955f15c Fix issues with new ChunkGenerator API a0a37f41 SPIGOT-6630: Replacing an enchantment on an item creates a conflict error Spigot Changes: b166a49b Rebuild patches 3c1fc60a SPIGOT-6693: Composters only take in one item at custom hopper speeds
64 Zeilen
3.4 KiB
Diff
64 Zeilen
3.4 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/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index ec8afe1bb9881c87c4ee0f15dcfcb4b8f318febc..e6ce1f9f065a2e6293a651922273a6034df19d0f 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -492,4 +492,9 @@ public class PaperConfig {
|
|
private static void trackPluginScoreboards() {
|
|
trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false);
|
|
}
|
|
+
|
|
+ public static boolean fixEntityPositionDesync = true;
|
|
+ private static void fixEntityPositionDesync() {
|
|
+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync);
|
|
+ }
|
|
}
|
|
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<ClientGamePa
|
|
protected final boolean hasPos;
|
|
|
|
public static long entityToPacket(double coord) {
|
|
- return Mth.lfloor(coord * 4096.0D);
|
|
+ return Mth.lfloor(coord * 4096.0D); // Paper - check ItemEntity#setPosRaw on update
|
|
}
|
|
|
|
public static double packetToEntity(long coord) {
|
|
- return (double)coord / 4096.0D;
|
|
+ return (double)coord / 4096.0D; // Paper - check ItemEntity#setPosRaw on update
|
|
}
|
|
|
|
public Vec3 updateEntityPosition(Vec3 orig) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 5ff6afc2a5fbf9f2bec34621d63a400e2acc1d63..f0ca8889d9e020dd0c20ff35acadeeac35a0957e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -3762,6 +3762,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
|
}
|
|
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
|
// Paper end
|
|
+ // Paper start - fix MC-4
|
|
+ if (this instanceof ItemEntity) {
|
|
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
|
|
+ // encode/decode from PacketPlayOutEntity
|
|
+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D);
|
|
+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D);
|
|
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);
|
|
+ }
|
|
+ }
|
|
+ // 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);
|