Interface IPositionProvider

All Known Implementing Classes:
CachedPositionProvider, EntityPositionProvider, PositionProvider, PositionSetProvider, ScopedPositionProvider

public interface IPositionProvider
Get positional information a sensor returns in matching state.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Reset position provider so that hasPosition() will return false.
    Return target entity if sensor provides it currently.
    double
    Return x coordinate of available position.
    double
    Return y coordinate of available position.
    double
    Return z coordinate of available position.
    boolean
    Test if PositionProvider does return a position currently.
    default boolean
    Writes the orientation of the current (primary) position into out, when one is available.
    boolean
    providePosition(org.joml.Vector3d result)
    Test and return sensor positional result if available.
  • Method Details

    • hasPosition

      boolean hasPosition()
      Test if PositionProvider does return a position currently.
      Returns:
      if true providePosition and getX/Y/Z will return positional result of sensor
    • providePosition

      boolean providePosition(org.joml.Vector3d result)
      Test and return sensor positional result if available.
      Parameters:
      result - Vector3d receiving position information if available
      Returns:
      True if position is available and result was updated, false if no position available
    • getX

      double getX()
      Return x coordinate of available position.
      Returns:
      Coordinate if position available else result is undefined.
    • getY

      double getY()
      Return y coordinate of available position.
      Returns:
      Coordinate if position available else result is undefined.
    • getZ

      double getZ()
      Return z coordinate of available position.
      Returns:
      Coordinate if position available else result is undefined.
    • getTarget

      @Nullable Ref<EntityStore> getTarget()
      Return target entity if sensor provides it currently.

      A sensor might return a valid position but return a null value here if this position does not correlate to an entity.

      Returns:
      entity ref if sensor is matching and result refers to an entity, else null.
    • provideOrientation

      default boolean provideOrientation(Rotation3f out)
      Writes the orientation of the current (primary) position into out, when one is available.
      Returns:
      true if an orientation was written, false otherwise (in which case out is left untouched).
    • clear

      void clear()
      Reset position provider so that hasPosition() will return false.