mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 16:37:38 +01:00
Use block position for intersection check
This commit is contained in:
parent
ef46a365d1
commit
4f20580482
@ -58,14 +58,14 @@ public class BoundingBox {
|
|||||||
*/
|
*/
|
||||||
public boolean intersectWithBlock(@NotNull Point blockPosition) {
|
public boolean intersectWithBlock(@NotNull Point blockPosition) {
|
||||||
final double offsetX = 1;
|
final double offsetX = 1;
|
||||||
final double x = blockPosition.x();
|
final double x = blockPosition.blockX();
|
||||||
final double maxX = x + offsetX;
|
final double maxX = x + offsetX;
|
||||||
|
|
||||||
final boolean checkX = getMinX() < maxX && getMaxX() > x;
|
final boolean checkX = getMinX() < maxX && getMaxX() > x;
|
||||||
if (!checkX)
|
if (!checkX)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
final double y = blockPosition.y();
|
final double y = blockPosition.blockY();
|
||||||
final double maxY = y + 0.99999;
|
final double maxY = y + 0.99999;
|
||||||
|
|
||||||
final boolean checkY = getMinY() < maxY && getMaxY() > y;
|
final boolean checkY = getMinY() < maxY && getMaxY() > y;
|
||||||
@ -73,7 +73,7 @@ public class BoundingBox {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
final double offsetZ = 1;
|
final double offsetZ = 1;
|
||||||
final double z = blockPosition.z();
|
final double z = blockPosition.blockZ();
|
||||||
final double maxZ = z + offsetZ;
|
final double maxZ = z + offsetZ;
|
||||||
|
|
||||||
// Z check
|
// Z check
|
||||||
|
Loading…
Reference in New Issue
Block a user