From a255fe6b7338836a7ca9933ba045395c061ed960 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Thu, 24 Jun 2021 21:08:15 -0500 Subject: [PATCH] Move MC-4 fix back to ItemEntity --- patches/server/0146-Add-MC-4-fix-back.patch | 52 +++++++++++++++---- ...204-API-for-any-mob-to-burn-daylight.patch | 4 +- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/patches/server/0146-Add-MC-4-fix-back.patch b/patches/server/0146-Add-MC-4-fix-back.patch index c6b9d56e4..255fb18a0 100644 --- a/patches/server/0146-Add-MC-4-fix-back.patch +++ b/patches/server/0146-Add-MC-4-fix-back.patch @@ -5,15 +5,49 @@ Subject: [PATCH] Add MC-4 fix back diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 97c1d86519370665d9f3eccedea03196a9681c80..3918287a997887051eb85810f91bb67f23c31df5 100644 +index 97c1d86519370665d9f3eccedea03196a9681c80..7e3270945d60d6b0664020f7988300b5f8e91a20 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4032,7 +4032,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n - public final void setPosRaw(double x, double y, double z) { - // Paper start - fix MC-4 - if (this instanceof ItemEntity) { +@@ -4029,17 +4029,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n + return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); + } + +- public final void setPosRaw(double x, double y, double z) { +- // Paper start - fix MC-4 +- if (this instanceof ItemEntity) { - if (false && com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) { // Tuinity - revert -+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) { // Tuinity - revert // Purpur - no - // encode/decode from PacketPlayOutEntity - x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D); - y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D); +- // 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 ++ public void setPosRaw(double x, double y, double z) { // Purpur - remove final for ItemEntity + // Paper start - never allow AABB to become desynced from position + // hanging has its own special logic + if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (this.position.x != x || this.position.y != y || this.position.z != z)) { +diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +index 5201e59c7ce9e92790c185279ba69d7fbbfccf90..8845c7b55ac1e6284c4fcd69b395dfb1f5523f90 100644 +--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +@@ -87,6 +87,19 @@ public class ItemEntity extends Entity { + this.bobOffs = entity.bobOffs; + } + ++ // Purpur start - fix MC-4 ++ @Override ++ public void setPosRaw(double x, double y, double z) { ++ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) { // Tuinity - revert // Purpur - No. ++ // 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); ++ } ++ super.setPosRaw(x, y, z); ++ } ++ // Purpur end - fix MC-4 ++ + @Override + public boolean occludesVibrations() { + return ItemTags.OCCLUDES_VIBRATION_SIGNALS.contains(this.getItem().getItem()); diff --git a/patches/server/0204-API-for-any-mob-to-burn-daylight.patch b/patches/server/0204-API-for-any-mob-to-burn-daylight.patch index 667559284..f532b8f2b 100644 --- a/patches/server/0204-API-for-any-mob-to-burn-daylight.patch +++ b/patches/server/0204-API-for-any-mob-to-burn-daylight.patch @@ -6,10 +6,10 @@ Subject: [PATCH] API for any mob to burn daylight Co-authored by: Encode42 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ef4a8b0a072cb6350fd0102417d94ea2c222d5dc..e78dad0ac30c8b5eb89c5780104c159701af5dfd 100644 +index 600f28d018c6792636ce28c64a6f6ff1e990a84d..7f89c659f7fa51bdbf5d7f4aecc5026ded27d806 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4275,5 +4275,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -4265,5 +4265,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public boolean canSaveToDisk() { return true; }