From e08de25a2a9b70e86c5339cc67cac709e977247e Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 15 Jul 2024 09:56:17 -0700 Subject: [PATCH] Avoid collision shapes outside world border in findFreePosition This is to correctly adhere to Vanilla behavior. --- patches/server/Moonrise-optimisation-patches.patch | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/patches/server/Moonrise-optimisation-patches.patch b/patches/server/Moonrise-optimisation-patches.patch index f3c94c809a..1137a6e777 100644 --- a/patches/server/Moonrise-optimisation-patches.patch +++ b/patches/server/Moonrise-optimisation-patches.patch @@ -31633,6 +31633,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + null + ); + ++ final WorldBorder worldBorder = this.getWorldBorder(); ++ if (worldBorder != null) { ++ aabbs.removeIf((final AABB aabb) -> { ++ return !worldBorder.isWithinBounds(aabb); ++ }); ++ voxels.removeIf((final VoxelShape shape) -> { ++ return !worldBorder.isWithinBounds(shape.bounds()); ++ }); ++ } ++ + // push voxels into aabbs + for (int i = 0, len = voxels.size(); i < len; ++i) { + aabbs.addAll(voxels.get(i).toAabbs());