Class RelativeVec

java.lang.Object
net.minestom.server.utils.location.RelativeVec

public final class RelativeVec extends Object
Represents a location which can have fields relative to an Entity position.
  • Constructor Details

    • RelativeVec

      public RelativeVec(@NotNull @NotNull Vec vec, @NotNull @NotNull RelativeVec.CoordinateType coordinateType, boolean relativeX, boolean relativeY, boolean relativeZ)
  • Method Details

    • coordinateType

      @NotNull public @NotNull RelativeVec.CoordinateType coordinateType()
    • from

      @NotNull public @NotNull Vec from(@Nullable @Nullable 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 Vec fromView(@Nullable @Nullable Pos point)
    • from

      @NotNull public @NotNull 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 Vec fromSender(@Nullable @Nullable CommandSender sender)
    • fromView

      @Experimental @NotNull public @NotNull Vec fromView(@Nullable @Nullable Entity entity)
    • 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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object