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
-
Method Summary
Modifier and TypeMethodDescription@NotNull Point
add
(double value) @NotNull Point
add
(double x, double y, double z) @NotNull BlockVec
add
(int value) @NotNull BlockVec
add
(int x, int y, int z) @NotNull BlockVec
@NotNull Point
@NotNull Vec
asVec()
@NotNull Point
div
(double value) @NotNull Point
div
(double x, double y, double z) @NotNull Point
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.@NotNull Point
mul
(double value) @NotNull Point
mul
(double x, double y, double z) @NotNull Point
@NotNull BlockVec
@NotNull Point
sub
(double value) @NotNull Point
sub
(double x, double y, double z) @NotNull BlockVec
sub
(int value) @NotNull BlockVec
sub
(int x, int y, int z) @NotNull BlockVec
@NotNull Point
final String
toString()
Returns a string representation of this record class.@NotNull BlockVec
withBlockX
(int x) @NotNull BlockVec
withBlockY
(int y) @NotNull BlockVec
withBlockZ
(int z) @NotNull Point
withX
(double x) Creates a point with the specified X coordinate.@NotNull Point
withX
(@NotNull DoubleUnaryOperator operator) Creates a point with a modified X coordinate based on its value.@NotNull Point
withY
(double y) Creates a point with the specified Y coordinate.@NotNull Point
withY
(@NotNull DoubleUnaryOperator operator) Creates a point with a modified Y coordinate based on its value.@NotNull Point
withZ
(double z) Creates a point with the specified Z coordinate.@NotNull Point
withZ
(@NotNull DoubleUnaryOperator operator) Creates a point with a modified Z coordinate based on its value.double
x()
Returns the value of thex
record component.double
y()
Returns the value of they
record component.double
z()
Returns the value of thez
record component.
-
Constructor Details
-
BlockVec
public BlockVec(double x, double y, double z) Creates an instance of aBlockVec
record class.- Parameters:
x
- the value for thex
record componenty
- the value for they
record componentz
- the value for thez
record component
-
BlockVec
public BlockVec(int x, int y, int z) -
BlockVec
-
-
Method Details
-
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
-
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 thex
record component. -
y
public double y()Returns the value of they
record component. -
z
public double z()Returns the value of thez
record component.
-