Class CustomPathfinder

java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.CustomPathfinder
All Implemented Interfaces:
PathfinderInfo

public abstract class CustomPathfinder extends Pathfinder
Represents an extendable Pathfinder for creating Custom Pathfinders.
  • Constructor Details

    • CustomPathfinder

      protected CustomPathfinder(@NotNull @NotNull Mob m)
      Constructs a CustomPathfinder.
      Parameters:
      m - Mob to use
  • Method Details

    • getFlags

      @NotNull public abstract @NotNull Pathfinder.PathfinderFlag[] getFlags()
      The flags of this Custom Pathfinder. Can be null for no flags.

      Example:

       // public class LavaFloat extends CustomPathfinder {
      
       // This Pathfinder Goal will involve movement and jumping, so we have to add it as a flag
       getFlags() {
          return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.JUMPING; }
       }
       
      Specified by:
      getFlags in class Pathfinder
      Returns:
      Flags
    • canStart

      public abstract boolean canStart()
      Whether this Custom Pathfinder can start.

      Any assignments to fields or checks should be in here. Return true for start() to automatically run.

      Example:
       // public class LavaFloat extends CustomPathfinder {
       import org.bukkit.Material;
       
       public boolean canStart() {
           return this.entity.getLocation().getBlock().getType() == Material.LAVA; 
       } 
      
       
      Returns:
      true if Pathfinder can start, else false
    • start

      public abstract void start()
      Called on the first tick this Pathfinder starts, when canStart() returns true.

      Any actions that this Pathfinder will call first should be in here. This method will run automatically.

      Example:
       // public class LavaFloat extends CustomPathfinder {
      
       // Beginning Movements
       public void start() {
           // Get Entity Brain
           brain.getController().jump();
           brain.getController().strafe(1F, 0F);
       }
       
    • tick

      public abstract void tick()
      Called in between start() and stop().

      Any actions that this Pathfinder will call in between should be in here. This method will run automatically.

      Example:
       // public class LavaFloat extends CustomPathfinder {
       
       // No action for this is needed, so this can be blank
       public void tick() {}
       
    • stop

      public void stop()
      Called when this Pathfinder stops being used.

      Any actions that this Pathfinder will call when it stops should be in here. This method will run automatically.
    • canInterrupt

      public boolean canInterrupt()
      Whether this Pathfinder Goal can be interrupted. Default: true
      Returns:
      true if Pathfinder can be interrupted, else false
    • canContinueToUse

      public boolean canContinueToUse()
      Whether this Pathfinder Goal will continue to be used.

      Override this method if you have additional checks after the Pathfinder has started. By default, it will call canStart().

      Returns:
      true if Pathfinder can continue to use, else false
    • getInternalName

      @Internal public String getInternalName()
      Deprecated.
      Internal Use only
      Description copied from interface: PathfinderInfo
      Returns the NMS Internal Name.
      Returns:
      Internal Name