Paper/patches/server/0426-Ensure-Entity-AABB-s-are-never-invalid.patch
Jake Potrebic 38be4f873b
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9018)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2c64d8c4 SPIGOT-7309: Add API for jukebox inventories
a6d7e4ca PR-826: Add Sniffer API

CraftBukkit Changes:
93813509b SPIGOT-7309: Add API for jukebox inventories
2d5209e8d PR-1153: Handle teleport reason in spreadplayers command
f5b61387e SPIGOT-7308: Fix NullPointerException when calling Jukebox#setRecord()
388d458a6 SPIGOT-7306: Fix reset of coords in default teleportTo in EntityPlayer
40b87e1af PR-1150: Add Sniffer API and handle EntityItemDropEvent

Spigot Changes:
6ad4b93c SPIGOT-7298: Fix debug stick always permission left click toggle
2023-03-24 13:38:40 -07:00

47 lines
2.2 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 b95ef3e7c13cee1af59bdb8aa4cc01adb3ae7953..b69615eafcee963862cb3671888dcf8ec5114fe5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -714,8 +714,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() {
@@ -4074,6 +4074,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
// Paper start - rewrite chunk system
if (this.updatingSectionStatus) {
LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable());
@@ -4097,6 +4102,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() {}