Files
Purpur/patches/server/0148-Add-MC-4-fix-back.patch
William Blake Galbreath 655af9a48c Component related conveniences
2021-06-29 21:43:43 -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 57a80aed6106ec55aeb636c5b5f3abc7fb4fff14..7ebbe6588256471b6e5903ed6aaa20878340332e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4026,17 +4026,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());