1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-16 18:31:53 +01:00

Avoid collision shapes outside world border in findFreePosition

This is to correctly adhere to Vanilla behavior.
This commit is contained in:
Spottedleaf 2024-07-15 09:56:17 -07:00
parent 084923b9ac
commit e08de25a2a

View file

@ -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());