Class AttackMoveAI<T extends net.minecraft.world.entity.Mob & IThreatTableEntity>
java.lang.Object
com.minecolonies.core.entity.ai.combat.TargetAI<T>
com.minecolonies.core.entity.ai.combat.AttackMoveAI<T>
- All Implemented Interfaces:
IStateAI
- Direct Known Subclasses:
DruidCombatAI,MeleeCombatAI,RaiderMeleeAI,RaiderRangedAI,RangeCombatAI
public class AttackMoveAI<T extends net.minecraft.world.entity.Mob & IThreatTableEntity>
extends TargetAI<T>
Moves the entity and triggers the attack
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longTime at which the next attack happens, worldtime + attackspeed(delay) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether we can attackprotected 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 booleanisInAttackDistance(net.minecraft.world.entity.LivingEntity target) Whether the target is in attack distanceprotected booleanisInDistanceForAttack(net.minecraft.world.entity.LivingEntity target) Check if the target is in distance for beeing attackedprotected PathResultmoveInAttackPosition(net.minecraft.world.entity.LivingEntity target) Movement to get into attack positionvoidResets the current target and removes it from all saved targets.protected IStateCheck and trigger an attackMethods inherited from class com.minecolonies.core.entity.ai.combat.TargetAI
checkForTarget, getSearchArea, getSearchRange, getYSearchRange, isAttackableTarget, isEntityValidTarget, isWithinPersecutionDistance, onTargetChange, onTargetDied, searchNearbyTarget, skipSearch
-
Field Details
-
nextAttackTime
protected long nextAttackTimeTime at which the next attack happens, worldtime + attackspeed(delay)
-
-
Constructor Details
-
AttackMoveAI
-
-
Method Details
-
resetTarget
public void resetTarget()Description copied from class:TargetAIResets the current target and removes it from all saved targets.- Overrides:
resetTargetin classTargetAI<T extends net.minecraft.world.entity.Mob & IThreatTableEntity>
-
isInAttackDistance
protected boolean isInAttackDistance(net.minecraft.world.entity.LivingEntity target) Whether the target is in attack distance- Parameters:
target-- Returns:
-
tryAttack
Check and trigger an attack- Returns:
-
canAttack
public boolean canAttack()Whether we can attack- Returns:
-
isInDistanceForAttack
protected boolean isInDistanceForAttack(net.minecraft.world.entity.LivingEntity target) Check if the target is in distance for beeing attacked- Parameters:
target- target to check- Returns:
- true if we do attack
-
doAttack
protected void doAttack(net.minecraft.world.entity.LivingEntity target) The actual attack triggered on the target- Parameters:
target-
-
getAttackDistance
protected double getAttackDistance()Get the attack distance- Returns:
- distance in blocks
-
getAttackDelay
protected int getAttackDelay()Get the delay to next attack in ticks- Returns:
- default 40 ticks
-
moveInAttackPosition
Movement to get into attack position- Parameters:
target- target to move towards- Returns:
- path result
-