Class PathfinderTempt

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

public final class PathfinderTempt extends Pathfinder implements SpeedModifier
Represents a Pathfinder for the logic of this Creature getting tempted to move to another entity, for when they hold a specific item.
  • Constructor Details

    • PathfinderTempt

      public PathfinderTempt(@NotNull @NotNull Creature m, @NotNull @NotNull ItemStack... items) throws IllegalArgumentException
      Constructs a PathfinderTempt with the default speed modifier.
      Parameters:
      m - Creature to use
      items - ItemStacks to be tempted by
      Throws:
      IllegalArgumentException - if item is null
    • PathfinderTempt

      public PathfinderTempt(@NotNull @NotNull Creature m, double speedMod, @NotNull @NotNull ItemStack... items) throws IllegalArgumentException
      Constructs a PathfinderTempt with an array of Items.
      Parameters:
      m - Creature to use
      speedMod - Speed Modifier while moving to target holding item
      items - Array of ItemStacks to be tempted by
      Throws:
      IllegalArgumentException - if items are null or empty
    • PathfinderTempt

      public PathfinderTempt(@NotNull @NotNull Creature m, double speedMod, @NotNull @NotNull Iterable<? extends ItemStack> items) throws IllegalArgumentException
      Constructs a PathfinderTempt.
      Parameters:
      m - Creature to use
      speedMod - Speed Modifier while moving to target holding item
      items - Collection of ItemStacks to be tempted by
      Throws:
      IllegalArgumentException - if items are null or empty
    • PathfinderTempt

      public PathfinderTempt(@NotNull @NotNull Creature m, double speedMod, @NotNull @NotNull Predicate<ItemStack> predicate)
      Constructs a PathfinderTempt
      Parameters:
      m - Creature to use
      speedMod - Speed Modifier while moving to target holding item
      predicate - Predicate that matches ItemStacks to be tempted by
  • Method Details

    • getItems

      @NotNull public @NotNull Set<ItemStack> getItems()
      Gets the Set of ItemStack belonging to this PathfinderTempt.
      Returns:
      Set of ItemStacks found
    • getPredicate

      public Predicate<ItemStack> getPredicate()
      Gets the Predicate for this PathfinderTempt. Accepts any items that are in getItems()
      Returns:
      Predicate for this PathfinderTempt
    • setPredicate

      public void setPredicate(Predicate<ItemStack> predicate)
      Sets the Predicate for this PathfinderTempt
      Parameters:
      predicate - the predicate to set it to
    • addItems

      public void addItems(@NotNull @NotNull ItemStack... items) throws IllegalArgumentException
      Adds an Array of ItemStacks to this PathfinderTempt.
      Parameters:
      items - Items to add
      Throws:
      IllegalArgumentException - if items are null
    • addItems

      public void addItems(@NotNull @NotNull Iterable<? extends ItemStack> items) throws IllegalArgumentException
      Adds a Collection of ItemStacks to this PathfinderTempt.
      Parameters:
      items - Items to add
      Throws:
      IllegalArgumentException - if items are null
    • removeItems

      public void removeItems(@NotNull @NotNull ItemStack... items) throws IllegalArgumentException
      Removes an Array of ItemStacks from this PathfinderTempt.
      Parameters:
      items - Items to remove
      Throws:
      IllegalArgumentException - if items are null
    • removeItems

      public void removeItems(@NotNull @NotNull Iterable<? extends ItemStack> items) throws IllegalArgumentException
      Removes a Collection of ItemStacks from this PathfinderTempt.
      Parameters:
      items - Items to remove
      Throws:
      IllegalArgumentException - if items are null
    • setItems

      public void setItems(@NotNull @NotNull Iterable<? extends ItemStack> items) throws IllegalArgumentException
      Sets the ItemStacks for this PathfinderTempt.
      Parameters:
      items - Collection of Items to use
      Throws:
      IllegalArgumentException - if Items are null or empty
    • setItems

      public void setItems(@NotNull @NotNull ItemStack... items) throws IllegalArgumentException
      Sets the ItemStacks for this PathfinderTempt/
      Parameters:
      items - Array of Items to use
      Throws:
      IllegalArgumentException - if Items are null or empty
    • 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
    • getFlags

      @NotNull public @NotNull Pathfinder.PathfinderFlag[] 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 pathfinder's internal name. This may match the actual NMS name of the pathfinder, but it may not.
      Specified by:
      getInternalName in interface PathfinderInfo
      Returns:
      Internal Name