Class RangeCombatAI
java.lang.Object
com.minecolonies.core.entity.ai.combat.TargetAI<T>
com.minecolonies.core.entity.ai.combat.AttackMoveAI<EntityCitizen>
com.minecolonies.core.entity.ai.workers.guard.RangeCombatAI
- All Implemented Interfaces:
IStateAI
Knight combat AI
-
Field Summary
Fields inherited from class com.minecolonies.core.entity.ai.combat.AttackMoveAI
nextAttackTime -
Constructor Summary
ConstructorsConstructorDescriptionRangeCombatAI(EntityCitizen owner, ITickRateStateMachine stateMachine, AbstractEntityAIGuard parentAI) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether we can attackprotected booleanChecks if the current targets is still valid, if not searches a new target.protected voiddoAttack(net.minecraft.world.entity.LivingEntity target) The actual attack triggered on the targetprotected intGet the delay to next attack in ticksprotected doubleGet the attack distanceprotected doubleGet combat speedGets the weapon type that the AI will look for when checking if it can attack.protected intGet the Y search rangeprotected booleanisAttackableTarget(net.minecraft.world.entity.LivingEntity entity) Whether the target is attackablebooleanCheck if is a marksman instance.protected booleanisWithinPersecutionDistance(net.minecraft.world.entity.LivingEntity target) Check if the target is within chasing distancedoubleprotected PathResultmoveInAttackPosition(net.minecraft.world.entity.LivingEntity target) Movement to get into attack positionprotected voidonTargetChange(net.minecraft.world.entity.LivingEntity newTarget) Actions on changing to a new target entityprotected voidonTargetDied(net.minecraft.world.entity.LivingEntity entity) When our previous target has diedprotected booleanskipSearch(net.minecraft.world.entity.LivingEntity entity) Skips the search if trueMethods inherited from class com.minecolonies.core.entity.ai.combat.AttackMoveAI
isInAttackDistance, isInDistanceForAttack, resetTarget, tryAttackMethods inherited from class com.minecolonies.core.entity.ai.combat.TargetAI
getSearchArea, getSearchRange, isEntityValidTarget, searchNearbyTarget
-
Constructor Details
-
RangeCombatAI
public RangeCombatAI(EntityCitizen owner, ITickRateStateMachine stateMachine, AbstractEntityAIGuard parentAI)
-
-
Method Details
-
canAttack
public boolean canAttack()Description copied from class:AttackMoveAIWhether we can attack- Overrides:
canAttackin classAttackMoveAI<EntityCitizen>- Returns:
-
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:TargetAIChecks if the current targets is still valid, if not searches a new target. Adds experience if the current target died.- Overrides:
checkForTargetin classTargetAI<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:AttackMoveAIThe actual attack triggered on the target- Overrides:
doAttackin classAttackMoveAI<EntityCitizen>
-
getAttackDistance
protected double getAttackDistance()Description copied from class:AttackMoveAIGet the attack distance- Overrides:
getAttackDistancein classAttackMoveAI<EntityCitizen>- Returns:
- distance in blocks
-
getAttackDelay
protected int getAttackDelay()Description copied from class:AttackMoveAIGet the delay to next attack in ticks- Overrides:
getAttackDelayin classAttackMoveAI<EntityCitizen>- Returns:
- default 40 ticks
-
isMarksman
public boolean isMarksman()Check if is a marksman instance.- Returns:
- true if so.
-
moveInAttackPosition
Description copied from class:AttackMoveAIMovement to get into attack position- Overrides:
moveInAttackPositionin classAttackMoveAI<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:TargetAIWhether the target is attackable- Overrides:
isAttackableTargetin classTargetAI<EntityCitizen>- Returns:
-
isWithinPersecutionDistance
protected boolean isWithinPersecutionDistance(net.minecraft.world.entity.LivingEntity target) Description copied from class:TargetAICheck if the target is within chasing distance- Overrides:
isWithinPersecutionDistancein classTargetAI<EntityCitizen>- Returns:
-
skipSearch
protected boolean skipSearch(net.minecraft.world.entity.LivingEntity entity) Description copied from class:TargetAISkips the search if true- Overrides:
skipSearchin classTargetAI<EntityCitizen>- Parameters:
entity- checked entity- Returns:
- true if skip
-
onTargetChange
protected void onTargetChange(net.minecraft.world.entity.LivingEntity newTarget) Description copied from class:TargetAIActions on changing to a new target entity- Overrides:
onTargetChangein classTargetAI<EntityCitizen>
-
getYSearchRange
protected int getYSearchRange()Description copied from class:TargetAIGet the Y search range- Overrides:
getYSearchRangein classTargetAI<EntityCitizen>- Returns:
-
onTargetDied
protected void onTargetDied(net.minecraft.world.entity.LivingEntity entity) Description copied from class:TargetAIWhen our previous target has died- Overrides:
onTargetDiedin classTargetAI<EntityCitizen>
-