Package net.minestom.server.coordinate
Record Class RelativeVec
java.lang.Object
java.lang.Record
net.minestom.server.coordinate.RelativeVec
public record RelativeVec(@NotNull net.minestom.server.coordinate.Vec vec, @NotNull RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ)
extends Record
Represents a location which can have fields relative to an
Entity position.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRelativeVec(@NotNull net.minestom.server.coordinate.Vec vec, @NotNull RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ) Creates an instance of aRelativeVecrecord class. -
Method Summary
Modifier and TypeMethodDescription@NotNull RelativeVec.CoordinateTypeReturns the value of thecoordinateTyperecord component.final booleanIndicates whether some other object is "equal to" this one.@NotNull net.minestom.server.coordinate.Vecfrom(@Nullable net.minestom.server.coordinate.Pos origin) Gets the location based on the relative fields andposition.@NotNull net.minestom.server.coordinate.VecGets the location based on the relative fields andentity.@NotNull net.minestom.server.coordinate.VecfromSender(@Nullable CommandSender sender) net.minestom.server.coordinate.VecfromView(@Nullable net.minestom.server.coordinate.Pos point) @NotNull net.minestom.server.coordinate.Vecfinal inthashCode()Returns a hash code value for this object.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.@NotNull net.minestom.server.coordinate.Vecvec()Returns the value of thevecrecord component.
-
Constructor Details
-
RelativeVec
public RelativeVec(@NotNull @NotNull net.minestom.server.coordinate.Vec vec, @NotNull @NotNull 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
@NotNull public @NotNull net.minestom.server.coordinate.Vec from(@Nullable @Nullable net.minestom.server.coordinate.Pos origin) Gets the location based on the relative fields andposition.- Parameters:
origin- the origin position, null if none- Returns:
- the location
-
fromView
@Experimental public net.minestom.server.coordinate.Vec fromView(@Nullable @Nullable net.minestom.server.coordinate.Pos point) -
from
Gets the location based on the relative fields andentity.- Parameters:
entity- the entity to get the relative position from- Returns:
- the location
-
fromSender
@NotNull public @NotNull net.minestom.server.coordinate.Vec fromSender(@Nullable @Nullable CommandSender sender) -
fromView
@Experimental @NotNull public @NotNull net.minestom.server.coordinate.Vec fromView(@Nullable @Nullable Entity entity) -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
vec
@NotNull public @NotNull net.minestom.server.coordinate.Vec 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
-