Class PathfinderLookAtEntity<T extends LivingEntity>

java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.PathfinderLookAtEntity<T>
Type Parameters:
T - Type of LivingEntity to look at
All Implemented Interfaces:
PathfinderInfo, Ranged, Filtering<T>, Probable

public final class PathfinderLookAtEntity<T extends LivingEntity> extends Pathfinder implements Filtering<T>, Probable, Ranged
Represents a Pathfinder for an Entity to look at another Entity
  • Field Details

    • DEFAULT_PROBABILITY

      public static final float DEFAULT_PROBABILITY
      Default Probability to look at an Entity (0.02F)
      See Also:
  • Constructor Details

    • PathfinderLookAtEntity

      public PathfinderLookAtEntity(@NotNull @NotNull Mob m, @NotNull @NotNull Class<T> filter)
      Constructs a PathfinderLookAtEntity with the default Ranged.DEFAULT_LOOK_RANGE.
      Parameters:
      m - Mob to use
      filter - Filter class to look at
    • PathfinderLookAtEntity

      public PathfinderLookAtEntity(@NotNull @NotNull Mob m, @NotNull @NotNull Class<T> filter, float lookRange)
      Constructs a PathfinderLookAtEntity with the default probability.
      Parameters:
      m - Mob to use
      filter - Filter class to look at
      lookRange - Range of blocks to find selected class filter
    • PathfinderLookAtEntity

      public PathfinderLookAtEntity(@NotNull @NotNull Mob m, @NotNull @NotNull Class<T> filter, float lookRange, float probability)
      Constructs a PathfinderLookAtEntity with horizontal set to false.
      Parameters:
      m - Mob to use
      filter - Filter class to look at
      lookRange - Range of blocks to find selected class filter
      probability - Probability (0.0 - 1.0) to look at something. Called every tick, recommended to be a low number. See DEFAULT_PROBABILITY.
    • PathfinderLookAtEntity

      public PathfinderLookAtEntity(@NotNull @NotNull Mob m, @NotNull @NotNull Class<T> filter, float lookRange, float probability, boolean horizontal)
      Constructs a PathfinderLookAtEntity.
      Parameters:
      m - Mob to use
      filter - Filter class to look at
      lookRange - Range of blocks to find selected class filter
      probability - Probability (0.0 - 1.0) to look at something. Called every tick, recommended to be a low number. See DEFAULT_PROBABILITY.
      horizontal - Whether rotation should only be horizontal
  • Method Details

    • getRange

      public float getRange()
      Description copied from interface: Ranged
      Gets the current Range.
      Specified by:
      getRange in interface Ranged
      Returns:
      Current Range
    • setRange

      public void setRange(float range)
      Description copied from interface: Ranged
      Sets the current Range.
      Specified by:
      setRange in interface Ranged
      Parameters:
      range - Range to set
    • getProbability

      public float getProbability()
      Description copied from interface: Probable
      Get the current probability of this Pathfinder.
      Specified by:
      getProbability in interface Probable
      Returns:
      Probability of this Pathfinder happening
    • setProbability

      public void setProbability(float prob)
      Description copied from interface: Probable
      Sets the current probability of this Pathfinder.
      Specified by:
      setProbability in interface Probable
      Parameters:
      prob - Probability to set
    • setFilter

      public void setFilter(@NotNull @NotNull Class<T> clazz)
      Description copied from interface: Filtering
      Set the Filter that this Pathfinder is looking for.
      Specified by:
      setFilter in interface Filtering<T extends LivingEntity>
      Parameters:
      clazz - Filter to set
    • getFilter

      public Class<T> getFilter()
      Description copied from interface: Filtering
      Get the filter that this Pathfinder is looking for.
      Specified by:
      getFilter in interface Filtering<T extends LivingEntity>
      Returns:
      Filter found
    • isHorizontal

      public boolean isHorizontal()
      Whether the Looking Rotation is only horizontal.
      Returns:
      true if rotation is only horizontal, else false
    • setHorizontal

      public void setHorizontal(boolean horizontal)
      Sets whether the Looking Rotation is only horizontal.
      Parameters:
      horizontal - true if rotation is only horizontal, else false
    • getFlags

      Description copied from class: Pathfinder

      Fetches an Array of Flags that this Pathfinder has.

      Specified by:
      getFlags in class Pathfinder
      Returns:
      Array of Pathfinder Flags
    • getInternalName

      public String getInternalName()
      Description copied from interface: PathfinderInfo
      Returns the NMS Internal Name.
      Specified by:
      getInternalName in interface PathfinderInfo
      Returns:
      Internal Name