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
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    RelativeVec(@NotNull net.minestom.server.coordinate.Vec vec, @NotNull RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ)
    Creates an instance of a RelativeVec record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the coordinateType record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NotNull net.minestom.server.coordinate.Vec
    from(@Nullable net.minestom.server.coordinate.Pos origin)
    Gets the location based on the relative fields and position.
    @NotNull net.minestom.server.coordinate.Vec
    from(@Nullable Entity entity)
    Gets the location based on the relative fields and entity.
    @NotNull net.minestom.server.coordinate.Vec
    fromSender(@Nullable CommandSender sender)
     
    net.minestom.server.coordinate.Vec
    fromView(@Nullable net.minestom.server.coordinate.Pos point)
     
    @NotNull net.minestom.server.coordinate.Vec
    fromView(@Nullable Entity entity)
     
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the relativeX record component.
    boolean
    Returns the value of the relativeY record component.
    boolean
    Returns the value of the relativeZ record component.
    final String
    Returns a string representation of this record class.
    @NotNull net.minestom.server.coordinate.Vec
    vec()
    Returns the value of the vec record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 a RelativeVec record class.
      Parameters:
      vec - the value for the vec record component
      coordinateType - the value for the coordinateType record component
      relativeX - the value for the relativeX record component
      relativeY - the value for the relativeY record component
      relativeZ - the value for the relativeZ record 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 and position.
      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

      @NotNull public @NotNull net.minestom.server.coordinate.Vec from(@Nullable @Nullable Entity entity)
      Gets the location based on the relative fields and entity.
      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • vec

      @NotNull public @NotNull net.minestom.server.coordinate.Vec vec()
      Returns the value of the vec record component.
      Returns:
      the value of the vec record component
    • coordinateType

      @NotNull public @NotNull RelativeVec.CoordinateType coordinateType()
      Returns the value of the coordinateType record component.
      Returns:
      the value of the coordinateType record component
    • relativeX

      public boolean relativeX()
      Returns the value of the relativeX record component.
      Returns:
      the value of the relativeX record component
    • relativeY

      public boolean relativeY()
      Returns the value of the relativeY record component.
      Returns:
      the value of the relativeY record component
    • relativeZ

      public boolean relativeZ()
      Returns the value of the relativeZ record component.
      Returns:
      the value of the relativeZ record component