From 6b1c9fcef695183ff6c866ec287ed058db8643c9 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Sat, 26 Jun 2021 20:27:57 +0200 Subject: [PATCH] Ensure shulker bounding box is updated A previous paper patch introduced bounding box reuse for entities on position updates if the x,y and z coordinate did not change. While this reusing in itself works fine, shulkers do update their bounding box without actually changing their x,y and z coordinates which is not respected due to the old bounding box being reused. This commit fixes this issue by manually updating the shulker bounding box after reapplying the position. Another alternative solution would have been an exception specifically made for shulkers to ignore the reuse logic, tho this would introduce a new instanceOf check into the Entity#setPosRaw method and would be evaulated for every type of entity. See also: https://github.com/PaperMC/Paper/blob/master/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch Resolves: 5915 --- ...0467-Ensure-Entity-AABB-s-are-never-invalid.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch b/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch index d2509166bcd85..0d2c67f3373ca 100644 --- a/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/patches/server/0467-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -30,3 +30,15 @@ index 912723108af2ffe660f0c2e528e4e028f7f74bcb..b208f561ab8bb0ea9ad06fb2a30becef 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); +diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +index ca0d1c059a6ad94590bcbff34b37b9c13ef19474..c61f127342f404fbf766c64254fd191ff01f1507 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java +@@ -236,6 +236,7 @@ public class Shulker extends AbstractGolem implements Enemy { + + private void onPeekAmountChange() { + this.reapplyPosition(); ++ this.setBoundingBox(this.makeBoundingBox()); // Paper - manually update bounding box as paper caches bounding box if the entity did not move (See Entity#setPosRaw) + float f = Shulker.getPhysicalPeek(this.currentPeekAmount); + float f1 = Shulker.getPhysicalPeek(this.currentPeekAmountO); + Direction enumdirection = this.getAttachFace().getOpposite();