mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 9a129fa99 Add #getEligibleHumans to SkeletonHorseTrapEvent b5e23c7a6 Fix merging spawning values a932e8ad7 Turn off spigot verbose world by default 8ced89f65 Fix Delegation to vanilla chunk gen
55 lines
3.1 KiB
Diff
55 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
Date: Sat, 6 Jul 2019 21:12:58 -0500
|
|
Subject: [PATCH] MC-4 Fix - Item position desync
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index f322dccd83..5cb6bb896e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -134,6 +134,12 @@ public class EntityTrackerEntry {
|
|
double vec3d_dz = this.tracker.locZ() - 2.44140625E-4D*(this.zLoc);
|
|
boolean flag1 = (vec3d_dx * vec3d_dx + vec3d_dy * vec3d_dy + vec3d_dz * vec3d_dz) >= 7.62939453125E-6D;
|
|
// Paper end - reduce allocation of Vec3D here
|
|
+ // Purpur start - fix MC-4
|
|
+ if (net.pl3x.purpur.PurpurConfig.fixItemPositionDesync && this.tracker instanceof EntityItem) {
|
|
+ Vec3D loc = PacketPlayOutEntity.decrypt(PacketPlayOutEntity.encrypt(tracker.locX()), PacketPlayOutEntity.encrypt(tracker.locY()), PacketPlayOutEntity.encrypt(tracker.locZ()));
|
|
+ tracker.setPosition(loc.getX(), loc.getY(), loc.getZ());
|
|
+ }
|
|
+ // Purpur end - fix MC-4
|
|
Packet<?> packet1 = null;
|
|
boolean flag2 = flag1 || this.tickCounter % 60 == 0;
|
|
boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;
|
|
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
index e5da2b19c1..6d9d52e4fc 100644
|
|
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
|
@@ -14,10 +14,12 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
|
protected boolean h;
|
|
protected boolean i;
|
|
|
|
+ public static long encrypt(double d) { return a(d); } // Purpur - OBFHELPER
|
|
public static long a(double d0) {
|
|
return MathHelper.d(d0 * 4096.0D);
|
|
}
|
|
|
|
+ public static Vec3D decrypt(long x, long y, long z) { return a(x, y, z); } // Purpur - OBFHELPER
|
|
public static Vec3D a(long i, long j, long k) {
|
|
return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D);
|
|
}
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index 1443034d21..55416be665 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -177,4 +177,9 @@ public class PurpurConfig {
|
|
InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
|
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
|
}
|
|
+
|
|
+ public static boolean fixItemPositionDesync = false;
|
|
+ private static void fixItemPositionDesync() {
|
|
+ fixItemPositionDesync = getBoolean("settings.fix-item-position-desync", fixItemPositionDesync);
|
|
+ }
|
|
}
|