Class RelativeLocation<T>

java.lang.Object
net.minestom.server.utils.location.RelativeLocation<T>
Type Parameters:
T - the location type
Direct Known Subclasses:
RelativeBlockPosition, RelativeVec

public abstract class RelativeLocation<T>
extends java.lang.Object
Represents a location which can have fields relative to an Entity position.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected T location  
    protected boolean relativeX  
    protected boolean relativeY  
    protected boolean relativeZ  
  • Constructor Summary

    Constructors 
    Constructor Description
    RelativeLocation​(T location, boolean relativeX, boolean relativeY, boolean relativeZ)  
  • Method Summary

    Modifier and Type Method Description
    abstract T fromRelativePosition​(Entity entity)
    Gets the location based on the relative fields and entity.
    boolean isRelativeX()
    Gets if the 'x' field is relative.
    boolean isRelativeY()
    Gets if the 'y' field is relative.
    boolean isRelativeZ()
    Gets if the 'z' field is relative.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • RelativeLocation

      public RelativeLocation​(@NotNull T location, boolean relativeX, boolean relativeY, boolean relativeZ)
  • Method Details

    • fromRelativePosition

      public abstract T fromRelativePosition​(@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
    • 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