java.lang.Object
java.lang.Record
net.minestom.server.coordinate.BlockVec
- All Implemented Interfaces:
Point
Represents an immutable block position.
Usage note: If you accept a block position as an argument to a method, it's usually better to accept a Point rather than a BlockVec to avoid callers continually having to convert.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabs()
add
(double value) add
(double x, double y, double z) add
(int value) add
(int x, int y, int z) int
blockX()
Returns the value of theblockX
record component.int
blockY()
Returns the value of theblockY
record component.int
blockZ()
Returns the value of theblockZ
record component.div
(double value) div
(double x, double y, double z) div
(int value) div
(int x, int y, int z) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.max
(int value) max
(int x, int y, int z) min
(int value) min
(int x, int y, int z) mul
(double value) mul
(double x, double y, double z) mul
(int value) mul
(int x, int y, int z) neg()
boolean
samePoint
(int x, int y, int z) boolean
sub
(double value) sub
(double x, double y, double z) sub
(int value) sub
(int x, int y, int z) final String
toString()
Returns a string representation of this record class.withBlockX
(int x) withBlockY
(int y) withBlockZ
(int 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.double
x()
Gets the X coordinate.double
y()
Gets the Y coordinate.double
z()
Gets the Z coordinate.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minestom.server.coordinate.Point
asBlockVec, asPos, asVec, chunkX, chunkZ, distance, distance, distanceSquared, distanceSquared, isZero, regionX, regionZ, sameBlock, sameBlock, sameChunk, samePoint, samePoint, samePoint, samePoint, section, sectionX, sectionY, sectionZ
-
Field Details
-
ZERO
-
ONE
-
SECTION
-
-
Constructor Details
-
BlockVec
public BlockVec(double x, double y, double z) -
BlockVec
-
BlockVec
public BlockVec(int value) -
BlockVec
public BlockVec(double value) -
BlockVec
public BlockVec(int blockX, int blockY, int blockZ) Creates an instance of aBlockVec
record class.- Parameters:
blockX
- the value for theblockX
record componentblockY
- the value for theblockY
record componentblockZ
- the value for theblockZ
record component
-
-
Method Details
-
x
public double x()Description copied from interface:Point
Gets the X coordinate. -
y
public double y()Description copied from interface:Point
Gets the Y coordinate. -
z
public double z()Description copied from interface:Point
Gets the Z coordinate. -
withX
Description copied from interface:Point
Creates a point with a modified X coordinate based on its value. -
withX
Description copied from interface:Point
Creates a point with the specified X coordinate. -
withBlockX
-
withY
Description copied from interface:Point
Creates a point with a modified Y coordinate based on its value. -
withY
Description copied from interface:Point
Creates a point with the specified Y coordinate. -
withBlockY
-
withZ
Description copied from interface:Point
Creates a point with a modified Z coordinate based on its value. -
withZ
Description copied from interface:Point
Creates a point with the specified Z coordinate. -
withBlockZ
-
add
-
add
-
add
-
add
-
add
-
add
-
sub
-
sub
-
sub
-
sub
-
sub
-
sub
-
mul
-
mul
-
mul
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
div
-
div
-
div
-
relative
-
neg
-
abs
-
min
-
min
-
min
-
min
-
max
-
max
-
max
-
max
-
samePoint
@Contract(pure=true) public boolean samePoint(int x, int y, int z) -
samePoint
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
blockX
public int blockX()Returns the value of theblockX
record component. -
blockY
public int blockY()Returns the value of theblockY
record component. -
blockZ
public int blockZ()Returns the value of theblockZ
record component.
-