Files
Purpur/patches/server/0146-Add-MC-4-fix-back.patch
2021-06-24 21:08:29 -05:00

54 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Thu, 7 Jan 2021 07:51:25 -0600
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..7e3270945d60d6b0664020f7988300b5f8e91a20 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -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
- // 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());