Paper/patches/server/0465-Ensure-Entity-AABB-s-are-never-invalid.patch
2021-06-15 21:53:50 -07:00

33 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 10 May 2020 22:12:46 -0400
Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b2a53fde2ba0316c33a4bfc58020849d5db02b51..9d08ebbbf2f3ff710022fb3ef1fce802a15f1b4e 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -540,7 +540,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
public void setPos(double x, double y, double z) {
this.setPosRaw(x, y, z);
- this.setBoundingBox(this.makeBoundingBox());
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
}
protected AABB makeBoundingBox() {
@@ -3717,6 +3717,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public final void setPosRaw(double x, double y, double z) {
+ // 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)) {
+ this.setBoundingBox(this.dimensions.makeBoundingBox(x, y, z));
+ }
+ // Paper end
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);