Class PathfinderMeleeAttack

java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.PathfinderMeleeAttack
All Implemented Interfaces:
PathfinderInfo, Targeting, SpeedModifier
Direct Known Subclasses:
PathfinderZombieAttack

public class PathfinderMeleeAttack extends Pathfinder implements SpeedModifier, Targeting
Represents a Pathfinder for a Creature to attack.

This Pathfinder does not look for entities to attack, but only attacks them. To look for entities, use PathfinderNearestAttackableTarget and its subclasses.

Any entities that do not normally attack (i.e. animals) most commonly do not have attack attributes.

An entity that attacks without an Attack Attribute will crash the server.
  • Constructor Details

    • PathfinderMeleeAttack

      public PathfinderMeleeAttack(@NotNull @NotNull Creature c)
      Constructs a PathfinderMeleeAttack with the default Speed Modifier.
      Parameters:
      c - Creature to use
    • PathfinderMeleeAttack

      public PathfinderMeleeAttack(@NotNull @NotNull Creature c, double speedMod)
      Constructs a PathfinderMeleeAttack with must see set to true.
      Parameters:
      c - Creature to use
      speedMod - Speed Modifier while attacking
    • PathfinderMeleeAttack

      public PathfinderMeleeAttack(@NotNull @NotNull Creature c, double speedMod, boolean see) throws IllegalArgumentException
      Constructs a PathfinderMeleeAttack.
      Parameters:
      c - Creature to use
      speedMod - Speed Modifier while attacking
      see - Whether the Creature must see the target in order to attack
      Throws:
      IllegalArgumentException - if interval is less than 0
  • Method Details

    • 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
    • mustSee

      public boolean mustSee()
      Description copied from interface: Targeting
      Whether the entity must see the target.
      Specified by:
      mustSee in interface Targeting
      Returns:
      true if entity must see, else false
    • setSee

      public void setSee(boolean see)
      Description copied from interface: Targeting
      Sets whether the entity must see the target.
      Specified by:
      setSee in interface Targeting
      Parameters:
      see - true if entity must see, 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