Class MeleeCombatAI

All Implemented Interfaces:
IStateAI
Direct Known Subclasses:
CavalryCombatAI

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

  • Method Details

    • attackProtect

      protected IAIState attackProtect()
      Check if the guard can protect himself with a shield And if so, do it.
      Returns:
      The next IAIState.
    • isHuscarl

      public boolean isHuscarl()
      Check if is a huscarl instance.
      Returns:
      true if so.
    • canAttack

      public boolean canAttack()
      Checks if the guard has a weapon to attack with.
      Overrides:
      canAttack in class AttackMoveAI<EntityCitizen>
      Returns:
      true if the guard can attack, false otherwise.
    • getWeaponType

      public EquipmentTypeEntry getWeaponType()
      Gets the weapon type that the AI will look for when checking if it can attack.
      Returns:
      the weapon type.
    • 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>
    • getCombatStatus

      protected VisibleCitizenStatus getCombatStatus()
    • getAttackDamage

      protected double getAttackDamage()
      Calculates the damage to deal
      Returns:
      attack damage
    • 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
    • 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>
    • getSearchRange

      protected int getSearchRange()
      Description copied from class: TargetAI
      The search range in blocks, used for determining a shaped aabb entity lookup
      Overrides:
      getSearchRange 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>