Use block position for intersection check

This commit is contained in:
TheMode 2021-07-09 20:25:22 +02:00
parent ef46a365d1
commit 4f20580482

View File

@ -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