13
0
geforkt von Mirrors/Paper

Fix world border edge collision (#10053)

The collision shape of the border is determined by flooring the min values and ceiling the max values, so the isCollidingWithBorder() function should mirror such behavior.
Dieser Commit ist enthalten in:
Lulu13022002 2023-12-20 06:31:07 +01:00
Ursprung 5b0b65027f
Commit bdae546a5e

Datei anzeigen

@ -1655,11 +1655,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ public static boolean isCollidingWithBorder(final WorldBorder worldborder, final double boxMinX, final double boxMaxX,
+ final double boxMinZ, final double boxMaxZ) {
+ final double borderMinX = worldborder.getMinX(); // -X
+ final double borderMaxX = worldborder.getMaxX(); // +X
+ // border size is rounded like the collide voxel shape of the border
+ final double borderMinX = Math.floor(worldborder.getMinX()); // -X
+ final double borderMaxX = Math.ceil(worldborder.getMaxX()); // +X
+
+ final double borderMinZ = worldborder.getMinZ(); // -Z
+ final double borderMaxZ = worldborder.getMaxZ(); // +Z
+ final double borderMinZ = Math.floor(worldborder.getMinZ()); // -Z
+ final double borderMaxZ = Math.ceil(worldborder.getMaxZ()); // +Z
+
+ // inverted check for world border enclosing the specified box expanded by -EPSILON
+ return (borderMinX - boxMinX) > CollisionUtil.COLLISION_EPSILON || (borderMaxX - boxMaxX) < -CollisionUtil.COLLISION_EPSILON ||