Record Class RelativeVec
java.lang.Object
java.lang.Record
net.minestom.server.utils.location.RelativeVec
public record RelativeVec(Vec vec, RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ)
extends Record
Represents a location which can have fields relative to an
Entity position.
Useful for parsing Vec2 or Vec3 types
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRelativeVec(Vec vec, RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ) Creates an instance of aRelativeVecrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecoordinateTyperecord component.final booleanIndicates whether some other object is "equal to" this one.Gets the location based on the relative fields andvec().Gets the location based on the relative fields.fromSender(@Nullable CommandSender sender) Computes a viewVecbased on the given point's yaw and pitch.Shorthand forfromView(Pos)final inthashCode()Returns a hash code value for this object.booleanGets if the 'x' field is relative.booleanGets if the 'y' field is relative.booleanGets if the 'z' field is relative.booleanReturns the value of therelativeXrecord component.booleanReturns the value of therelativeYrecord component.booleanReturns the value of therelativeZrecord component.final StringtoString()Returns a string representation of this record class.vec()Returns the value of thevecrecord component.
-
Constructor Details
-
RelativeVec
public RelativeVec(Vec vec, RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ) Creates an instance of aRelativeVecrecord class.- Parameters:
vec- the value for thevecrecord componentcoordinateType- the value for thecoordinateTyperecord componentrelativeX- the value for therelativeXrecord componentrelativeY- the value for therelativeYrecord componentrelativeZ- the value for therelativeZrecord component
-
-
Method Details
-
from
-
from
-
fromSender
-
fromView
-
fromView
-
isRelativeX
public boolean isRelativeX()Gets if the 'x' field is relative.- Returns:
- true if the 'x' field is relative
-
isRelativeY
public boolean isRelativeY()Gets if the 'y' field is relative.- Returns:
- true if the 'y' field is relative
-
isRelativeZ
public boolean isRelativeZ()Gets if the 'z' field is relative.- Returns:
- true if the 'z' field is relative
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
vec
Returns the value of thevecrecord component.- Returns:
- the value of the
vecrecord component
-
coordinateType
Returns the value of thecoordinateTyperecord component.- Returns:
- the value of the
coordinateTyperecord component
-
relativeX
public boolean relativeX()Returns the value of therelativeXrecord component.- Returns:
- the value of the
relativeXrecord component
-
relativeY
public boolean relativeY()Returns the value of therelativeYrecord component.- Returns:
- the value of the
relativeYrecord component
-
relativeZ
public boolean relativeZ()Returns the value of therelativeZrecord component.- Returns:
- the value of the
relativeZrecord component
-