mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: cc477e6a Force Plugins that use delayed tasks for init back in their place 597263fd Don't skip full player connection tick when dead e2c23475 Revert loaded entity list (#3304) fa87db6b Move another NetworkManager util into the inner class (#3303) 841c7d18 Make loaded entity list logic more consistent (#3301) 36f34f01 Updated Upstream (Bukkit/CraftBukkit) 5ca5f131 Rebuild all patches using the new rebuild pattern 1ccff6fa Add villager reputation API 5c0bfffa Speed up rebuilding patches and reduce diff f37381ea Optimize Network Manager to not need synchronization 8f9df2ed Anti Xray cleanup 878c66f1 No-Tick view distance implementation - Closes #3196 b87743c1 Stop copy-on-write operations for updating light data 97a9c972 Optimize isOutsideRange to use distance maps b4e629a2 Use distance map to optimise entity tracker / Misc Utils d80d1517 Optimize Entity Ticking to Loaded Chunks only 31d7686d Add item slot helper methods for various inventories (#3221) 75e1e3b3 Mob Goal API c7bc393a Revert "Don't flush packet queue off main thread" 1abd2bd2 Don't flush packet queue off main thread a4ed58a9 Clean up Direct Memory Region Files Fix for different Java versions 55e35019 Set cap on JDK per-thread native byte buffer cache b5101f4f Cleanup Region Files Direct Memory on close 81e655d7 Optimize Voxel Shape Merging ed9fc11f Sync position on teleportation 9c326fce Nanothing to see here 3e9fc24b Attempt to fix FastLogin maybe
64 lines
3.4 KiB
Diff
64 lines
3.4 KiB
Diff
From 38d451e1f9556d05be4854849084f53771e2b061 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
|
|
|
|
---
|
|
src/main/java/net/minecraft/server/EntityTrackerEntry.java | 6 ++++++
|
|
src/main/java/net/minecraft/server/PacketPlayOutEntity.java | 2 ++
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 2 ++
|
|
3 files changed, 10 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
index 8d4bcd34c..ec0abe429 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
@@ -127,6 +127,12 @@ public class EntityTrackerEntry {
|
|
j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
|
|
Vec3D vec3d = this.tracker.getPositionVector().d(PacketPlayOutEntity.a(this.xLoc, this.yLoc, this.zLoc));
|
|
boolean flag1 = vec3d.g() >= 7.62939453125E-6D;
|
|
+ // Purpur start - fixes 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
|
|
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 5b1d95935..0010448e3 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 68bad6a13..ab88636ca 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -163,8 +163,10 @@ public class PurpurConfig {
|
|
}
|
|
|
|
public static boolean dontSendUselessEntityPackets = false;
|
|
+ public static boolean fixItemPositionDesync = false;
|
|
private static void dontSendUselessEntityPackets() {
|
|
dontSendUselessEntityPackets = getBoolean("settings.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
|
|
+ fixItemPositionDesync = getBoolean("settings.fix-item-position-desync", fixItemPositionDesync);
|
|
}
|
|
|
|
public static boolean barrelSixRows = false;
|
|
--
|
|
2.24.0
|
|
|