Package net.minestom.server.coordinate
Record Class BlockVec
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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull Pointadd(double value) @NotNull Pointadd(double x, double y, double z) @NotNull BlockVecadd(int value) @NotNull BlockVecadd(int x, int y, int z) @NotNull BlockVec@NotNull Point@NotNull VecasVec()@NotNull Pointdiv(double value) @NotNull Pointdiv(double x, double y, double z) @NotNull Pointfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull Pointmul(double value) @NotNull Pointmul(double x, double y, double z) @NotNull Point@NotNull BlockVec@NotNull Pointsub(double value) @NotNull Pointsub(double x, double y, double z) @NotNull BlockVecsub(int value) @NotNull BlockVecsub(int x, int y, int z) @NotNull BlockVec@NotNull Pointfinal StringtoString()Returns a string representation of this record class.@NotNull BlockVecwithBlockX(int x) @NotNull BlockVecwithBlockY(int y) @NotNull BlockVecwithBlockZ(int z) @NotNull PointwithX(double x) Creates a point with the specified X coordinate.@NotNull PointwithX(@NotNull DoubleUnaryOperator operator) Creates a point with a modified X coordinate based on its value.@NotNull PointwithY(double y) Creates a point with the specified Y coordinate.@NotNull PointwithY(@NotNull DoubleUnaryOperator operator) Creates a point with a modified Y coordinate based on its value.@NotNull PointwithZ(double z) Creates a point with the specified Z coordinate.@NotNull PointwithZ(@NotNull DoubleUnaryOperator operator) Creates a point with a modified Z coordinate based on its value.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.doublez()Returns the value of thezrecord component.
-
Constructor Details
-
BlockVec
public BlockVec(double x, double y, double z) Creates an instance of aBlockVecrecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentz- the value for thezrecord component
-
BlockVec
public BlockVec(int x, int y, int z) -
BlockVec
-
-
Method Details
-
withX
Description copied from interface:PointCreates a point with a modified X coordinate based on its value. -
withX
Description copied from interface:PointCreates a point with the specified X coordinate. -
withBlockX
-
withY
Description copied from interface:PointCreates a point with a modified Y coordinate based on its value. -
withY
Description copied from interface:PointCreates a point with the specified Y coordinate. -
withBlockY
-
withZ
Description copied from interface:PointCreates a point with a modified Z coordinate based on its value. -
withZ
Description copied from interface:PointCreates a point with the specified Z coordinate. -
withBlockZ
-
add
-
add
-
add
-
add
-
add
-
add
-
sub
-
sub
-
sub
-
sub
-
sub
-
sub
-
mul
-
mul
-
mul
-
div
-
div
-
div
-
relative
-
asVec
-
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 '=='. -
x
public double x()Returns the value of thexrecord component. -
y
public double y()Returns the value of theyrecord component. -
z
public double z()Returns the value of thezrecord component.
-