Class PositionProvider

java.lang.Object
com.hypixel.hytale.server.npc.sensorinfo.InfoProviderBase
com.hypixel.hytale.server.npc.sensorinfo.PositionProvider
All Implemented Interfaces:
InfoProvider, IPositionProvider
Direct Known Subclasses:
CachedPositionProvider, EntityPositionProvider, ScopedPositionProvider

public class PositionProvider extends InfoProviderBase implements IPositionProvider
Helper class to implement a position provider for a plain position.
  • Constructor Details

  • Method Details

    • clear

      public void clear()
      Description copied from interface: IPositionProvider
      Reset position provider so that hasPosition() will return false.
      Specified by:
      clear in interface IPositionProvider
    • setTarget

      @Nullable public Ref<EntityStore> setTarget(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • setTarget

      @Nullable public Ref<EntityStore> setTarget(@Nullable Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor, boolean includeDead)
    • setTarget

      public void setTarget(@Nonnull org.joml.Vector3d pos)
    • setTarget

      public void setTarget(double x, double y, double z)
    • providePosition

      public boolean providePosition(@Nonnull org.joml.Vector3d result)
      Description copied from interface: IPositionProvider
      Test and return sensor positional result if available.
      Specified by:
      providePosition in interface IPositionProvider
      Parameters:
      result - Vector3d receiving position information if available
      Returns:
      True if position is available and result was updated, false if no position available
    • getX

      public double getX()
      Description copied from interface: IPositionProvider
      Return x coordinate of available position.
      Specified by:
      getX in interface IPositionProvider
      Returns:
      Coordinate if position available else result is undefined.
    • getY

      public double getY()
      Description copied from interface: IPositionProvider
      Return y coordinate of available position.
      Specified by:
      getY in interface IPositionProvider
      Returns:
      Coordinate if position available else result is undefined.
    • getZ

      public double getZ()
      Description copied from interface: IPositionProvider
      Return z coordinate of available position.
      Specified by:
      getZ in interface IPositionProvider
      Returns:
      Coordinate if position available else result is undefined.
    • getPositionProvider

      @Nonnull public IPositionProvider getPositionProvider()
      Description copied from interface: InfoProvider
      We provide direct access to the position provider as it's the most frequently used provider and is used in a very large number of actions and motions.
      Specified by:
      getPositionProvider in interface InfoProvider
      Returns:
      the position provider.
    • hasPosition

      public boolean hasPosition()
      Description copied from interface: IPositionProvider
      Test if PositionProvider does return a position currently.
      Specified by:
      hasPosition in interface InfoProvider
      Specified by:
      hasPosition in interface IPositionProvider
      Returns:
      if true providePosition and getX/Y/Z will return positional result of sensor
    • getTarget

      @Nullable public Ref<EntityStore> getTarget()
      Description copied from interface: IPositionProvider
      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.

      Specified by:
      getTarget in interface IPositionProvider
      Returns:
      entity ref if sensor is matching and result refers to an entity, else null.
    • provideOrientation

      public boolean provideOrientation(@Nonnull Rotation3f out)
      Description copied from interface: IPositionProvider
      Writes the orientation of the current (primary) position into out, when one is available.
      Specified by:
      provideOrientation in interface IPositionProvider
      Returns:
      true if an orientation was written, false otherwise (in which case out is left untouched).
    • setOrientation

      public void setOrientation(@Nonnull Rotation3fc orientation)
    • clearOrientation

      public void clearOrientation()