Class RangeCombatAI

All Implemented Interfaces:
IStateAI

public class RangeCombatAI extends AttackMoveAI<EntityCitizen>
Knight combat AI
  • Constructor Details

  • Method Details

    • canAttack

      public boolean canAttack()
      Description copied from class: AttackMoveAI
      Whether we can attack
      Overrides:
      canAttack in class AttackMoveAI<EntityCitizen>
      Returns:
    • getWeaponType

      public EquipmentTypeEntry getWeaponType()
      Gets the weapon type that the AI will look for when checking if it can attack.
      Returns:
      the weapon type.
    • checkForTarget

      protected boolean checkForTarget()
      Description copied from class: TargetAI
      Checks if the current targets is still valid, if not searches a new target. Adds experience if the current target died.
      Overrides:
      checkForTarget in class TargetAI<EntityCitizen>
      Returns:
      true if we found a target, false if no target.
    • doAttack

      protected void doAttack(net.minecraft.world.entity.LivingEntity target)
      Description copied from class: AttackMoveAI
      The actual attack triggered on the target
      Overrides:
      doAttack in class AttackMoveAI<EntityCitizen>
    • getAttackDistance

      protected double getAttackDistance()
      Description copied from class: AttackMoveAI
      Get the attack distance
      Overrides:
      getAttackDistance in class AttackMoveAI<EntityCitizen>
      Returns:
      distance in blocks
    • getAttackDelay

      protected int getAttackDelay()
      Description copied from class: AttackMoveAI
      Get the delay to next attack in ticks
      Overrides:
      getAttackDelay in class AttackMoveAI<EntityCitizen>
      Returns:
      default 40 ticks
    • isMarksman

      public boolean isMarksman()
      Check if is a marksman instance.
      Returns:
      true if so.
    • marksManTrueDamageShare

      public double marksManTrueDamageShare()
    • moveInAttackPosition

      protected PathResult moveInAttackPosition(net.minecraft.world.entity.LivingEntity target)
      Description copied from class: AttackMoveAI
      Movement to get into attack position
      Overrides:
      moveInAttackPosition in class AttackMoveAI<EntityCitizen>
      Parameters:
      target - target to move towards
      Returns:
      path result
    • getCombatMovementSpeed

      protected double getCombatMovementSpeed()
      Get combat speed
      Returns:
      movent speed
    • isAttackableTarget

      protected boolean isAttackableTarget(net.minecraft.world.entity.LivingEntity entity)
      Description copied from class: TargetAI
      Whether the target is attackable
      Overrides:
      isAttackableTarget in class TargetAI<EntityCitizen>
      Returns:
    • isWithinPersecutionDistance

      protected boolean isWithinPersecutionDistance(net.minecraft.world.entity.LivingEntity target)
      Description copied from class: TargetAI
      Check if the target is within chasing distance
      Overrides:
      isWithinPersecutionDistance in class TargetAI<EntityCitizen>
      Returns:
    • skipSearch

      protected boolean skipSearch(net.minecraft.world.entity.LivingEntity entity)
      Description copied from class: TargetAI
      Skips the search if true
      Overrides:
      skipSearch in class TargetAI<EntityCitizen>
      Parameters:
      entity - checked entity
      Returns:
      true if skip
    • onTargetChange

      protected void onTargetChange(net.minecraft.world.entity.LivingEntity newTarget)
      Description copied from class: TargetAI
      Actions on changing to a new target entity
      Overrides:
      onTargetChange in class TargetAI<EntityCitizen>
    • getYSearchRange

      protected int getYSearchRange()
      Description copied from class: TargetAI
      Get the Y search range
      Overrides:
      getYSearchRange in class TargetAI<EntityCitizen>
      Returns:
    • onTargetDied

      protected void onTargetDied(net.minecraft.world.entity.LivingEntity entity)
      Description copied from class: TargetAI
      When our previous target has died
      Overrides:
      onTargetDied in class TargetAI<EntityCitizen>