Class PathfinderMoveToBlock

java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.PathfinderMoveToBlock
All Implemented Interfaces:
PathfinderInfo, Ranged, SpeedModifier

public final class PathfinderMoveToBlock extends Pathfinder implements SpeedModifier, Ranged
Represents a Pathfinder for an Entity to move to another block
  • Field Details

    • DEFAULT_RANGE

      public static final int DEFAULT_RANGE
      Default Range to find Block (25)
      See Also:
  • Constructor Details

    • PathfinderMoveToBlock

      public PathfinderMoveToBlock(@NotNull @NotNull Creature c)
      Constructs a PathfinderMoveToBlock with the default Valid Block Predicate.
      Parameters:
      c - Creature to use
    • PathfinderMoveToBlock

      public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock)
      Constructs a PathfinderMoveToBlock with the Default Speed Modifier.
      Parameters:
      c - Creature to use
      validBlock - Function to check if the location is valid
    • PathfinderMoveToBlock

      public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod)
      Constructs a PathfinderMoveToBlock with the DEFAULT_RANGE;
      Parameters:
      c - Creature to use
      validBlock - Function to check if the location is valid
      speedMod - Speed Modifier while moving
    • PathfinderMoveToBlock

      public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod, int range)
      Constructs a PathfinderMoveToBlock with horizontal and vertical ranges identical.
      Parameters:
      c - Creature to use
      validBlock - Function to check if the location is valid
      speedMod - Speed Modifier while moving
      range - Range of blocks to look
    • PathfinderMoveToBlock

      public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod, int range, int vrange)
      Constructs a PathfinderMoveToBlock.
      Parameters:
      c - Creature to use
      validBlock - Function to check if the location is valid
      speedMod - Speed Modifier while moving
      range - Range of blocks to look
      vrange - Vertical range of blocks to look
  • Method Details

    • getRange

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

      public float getVerticalRange()
      Fetches the current vertical range of this Pathfinder.
      Returns:
      Vertical Range
    • setVerticalRange

      public void setVerticalRange(int vrange)
      Sets the vertical range of this Pathfinder.
      Parameters:
      vrange - Vertical Range
    • setRange

      public void setRange(float range) throws IllegalArgumentException
      Description copied from interface: Ranged
      Sets the current Range.
      Specified by:
      setRange in interface Ranged
      Parameters:
      range - Range to set
      Throws:
      IllegalArgumentException - if range is not an integer
    • getSpeedModifier

      public double getSpeedModifier()
      Description copied from interface: SpeedModifier
      Get the Speed Modifier of this Pathfinder.
      Specified by:
      getSpeedModifier in interface SpeedModifier
      Returns:
      Speed Modifier
    • setSpeedModifier

      public void setSpeedModifier(double mod)
      Description copied from interface: SpeedModifier
      Sets the Speed Modifier of this Pathfinder.
      Specified by:
      setSpeedModifier in interface SpeedModifier
      Parameters:
      mod - Modifier to set
    • getValidBlock

      @NotNull public @NotNull Predicate<Location> getValidBlock()
      Fetches the function called when checking if this block is valid, or a default of true if not set.
      Returns:
      Function called when checking if block is valid
    • setValidBlock

      public void setValidBlock(@Nullable @Nullable Predicate<Location> valid)
      Sets the function called when checking if this block is valid, can be null
      Parameters:
      valid - Function called when checking if block is valid
    • 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