Interface Point
-
Method Summary
Modifier and TypeMethodDescriptionadd(double value) add(double x, double y, double z) default BlockVecdefault PosasPos()default VecasVec()default intblockX()Gets the floored value of the X componentdefault intblockY()Gets the floored value of the Y componentdefault intblockZ()Gets the floored value of the Z componentdefault intchunkX()default intchunkZ()default doubledistance(double x, double y, double z) default doubleGets the distance between this point and another.default doubledistanceSquared(double x, double y, double z) default doubledistanceSquared(Point point) Gets the squared distance between this point and another.div(double value) div(double x, double y, double z) default booleanisZero()mul(double value) mul(double x, double y, double z) default intregionX()default intregionZ()default Pointdefault booleansameBlock(int blockX, int blockY, int blockZ) default booleanChecks if two points are in the same block.default booleanChecks if two points are in the same chunk.default booleansamePoint(double x, double y, double z) default booleansamePoint(double x, double y, double z, double epsilon) Checks it two points have similar (x/y/z) coordinates within a given epsilon.default booleanChecks it two points have similar (x/y/z).default booleanChecks it two points have similar (x/y/z) coordinates within a given epsilon.default intsection()Deprecated.default intsectionX()default intsectionY()default intsectionZ()sub(double value) sub(double x, double y, double z) withX(double x) Creates a point with the specified X coordinate.withX(DoubleUnaryOperator operator) Creates a point with a modified X coordinate based on its value.withY(double y) Creates a point with the specified Y coordinate.withY(DoubleUnaryOperator operator) Creates a point with a modified Y coordinate based on its value.withZ(double z) Creates a point with the specified Z coordinate.withZ(DoubleUnaryOperator operator) Creates a point with a modified Z coordinate based on its value.doublex()Gets the X coordinate.doubley()Gets the Y coordinate.doublez()Gets the Z coordinate.
-
Method Details
-
x
-
y
-
z
-
blockX
-
blockY
-
blockZ
-
sectionX
-
sectionY
-
sectionZ
-
chunkX
-
chunkZ
-
regionX
-
regionZ
-
section
Deprecated.usesectionY()instead. -
withX
Creates a point with a modified X coordinate based on its value.- Parameters:
operator- the operator providing the current X coordinate and returning the new- Returns:
- a new point
-
withX
-
withY
Creates a point with a modified Y coordinate based on its value.- Parameters:
operator- the operator providing the current Y coordinate and returning the new- Returns:
- a new point
-
withY
-
withZ
Creates a point with a modified Z coordinate based on its value.- Parameters:
operator- the operator providing the current Z coordinate and returning the new- Returns:
- a new point
-
withZ
-
add
-
add
-
add
-
sub
-
sub
-
sub
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
relative
-
distanceSquared
-
distanceSquared
-
distance
-
distance
Gets the distance between this point and another. The value of this method is not cached and uses a costly square-root function, so do not repeatedly call this method to get the vector's magnitude. NaN will be returned if the inner result of the sqrt() function overflows, which will be caused if the distance is too long.- Parameters:
point- the other point- Returns:
- the distance
-
samePoint
default boolean samePoint(double x, double y, double z) -
samePoint
Checks it two points have similar (x/y/z).- Parameters:
point- the point to compare- Returns:
- true if the two positions are similar
-
samePoint
default boolean samePoint(double x, double y, double z, double epsilon) Checks it two points have similar (x/y/z) coordinates within a given epsilon.- Parameters:
x- the x coordinate to comparey- the y coordinate to comparez- the z coordinate to compareepsilon- the maximum difference allowed between the two points (exclusive)- Returns:
- true if the two positions are similar within the epsilon
- Throws:
IllegalArgumentException- if epsilon is less than or equal to 0
-
samePoint
Checks it two points have similar (x/y/z) coordinates within a given epsilon.- Parameters:
point- the point to compareepsilon- the maximum difference allowed between the two points (exclusive)- Returns:
- true if the two positions are similar within the epsilon
- Throws:
IllegalArgumentException- if epsilon is less than or equal to 0
-
isZero
-
sameChunk
Checks if two points are in the same chunk.- Parameters:
point- the point to compare to- Returns:
- true if 'this' is in the same chunk as
point
-
sameBlock
default boolean sameBlock(int blockX, int blockY, int blockZ) -
sameBlock
Checks if two points are in the same block.- Parameters:
point- the point to compare to- Returns:
- true if 'this' is in the same block as
point
-
asPos
-
asVec
-
asBlockVec
-
sectionY()instead.