2021-06-14 08:37:14 +00:00
|
|
|
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
|
2021-11-25 09:19:05 +00:00
|
|
|
index 9d4dc7d8d8b6633a3e88a8fc43d3d798683ef1d9..8f634603a871567ea7f7e237856e844caf867dc0 100644
|
2021-06-14 08:37:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2021-11-25 09:19:05 +00:00
|
|
|
@@ -589,8 +589,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-07-09 01:18:32 +00:00
|
|
|
}
|
2021-06-14 08:37:14 +00:00
|
|
|
|
|
|
|
public void setPos(double x, double y, double z) {
|
2021-07-09 01:18:32 +00:00
|
|
|
- this.setPosRaw(x, y, z);
|
2021-06-14 08:37:14 +00:00
|
|
|
- this.setBoundingBox(this.makeBoundingBox());
|
2021-07-09 01:18:32 +00:00
|
|
|
+ this.setPosRaw(x, y, z, true); // Paper - force bounding box update
|
2021-06-14 08:37:14 +00:00
|
|
|
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
|
|
|
|
}
|
|
|
|
|
|
|
|
protected AABB makeBoundingBox() {
|
2021-11-25 09:19:05 +00:00
|
|
|
@@ -3761,6 +3761,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-06-14 08:37:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void setPosRaw(double x, double y, double z) {
|
2021-07-09 01:18:32 +00:00
|
|
|
+ // Paper start
|
|
|
|
+ this.setPosRaw(x, y, z, false);
|
|
|
|
+ }
|
|
|
|
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
2021-06-14 08:37:14 +00:00
|
|
|
+ // 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);
|
2021-11-25 09:19:05 +00:00
|
|
|
@@ -3783,6 +3788,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-07-09 01:18:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // 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) && (forceBoundingBoxUpdate || this.position.x != x || this.position.y != y || this.position.z != z)) {
|
|
|
|
+ this.setBoundingBox(this.makeBoundingBox());
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
public void checkDespawn() {}
|