mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
8399e10c43
prolly should be fixed in a mapping patch instead but I don't wanna
47 lines
2.1 KiB
Diff
47 lines
2.1 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 5a1dff0c0806ac7ca3d7db531f2a84be8ddc7ca4..a34797b5afd6460a5f98e9485c53d6963c6ee462 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -656,8 +656,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
public void setPos(double x, double y, double z) {
|
|
- this.setPosRaw(x, y, z);
|
|
- this.setBoundingBox(this.makeBoundingBox());
|
|
+ this.setPosRaw(x, y, z, true); // Paper - force bounding box update
|
|
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
|
|
}
|
|
|
|
protected AABB makeBoundingBox() {
|
|
@@ -3869,6 +3869,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
public final void setPosRaw(double x, double y, double z) {
|
|
+ // Paper start
|
|
+ this.setPosRaw(x, y, z, false);
|
|
+ }
|
|
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
|
+ // 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);
|
|
@@ -3886,6 +3891,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
this.levelCallback.onMove();
|
|
}
|
|
|
|
+ // 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() {}
|