Class MeleeAttackGoal
java.lang.Object
net.minecraft.world.entity.ai.goal.Goal
net.minecraft.world.entity.ai.goal.MeleeAttackGoal
- Direct Known Subclasses:
Bee.BeeAttackGoal, Fox.FoxMeleeAttackGoal, Panda.PandaAttackGoal, PolarBear.PolarBearMeleeAttackGoal, Spider.SpiderAttackGoal, ZombieAttackGoal
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final longprivate final booleanprivate longprotected final PathfinderMobprivate Pathprivate doubleprivate doubleprivate doubleprivate final doubleprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionMeleeAttackGoal(PathfinderMob mob, double speedModifier, boolean followingTargetEvenIfNotSeen) -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected booleancanPerformAttack(LivingEntity target) booleancanUse()protected voidcheckAndPerformAttack(LivingEntity target) protected intprotected intprotected booleanbooleanprotected voidvoidstart()voidstop()voidtick()Methods inherited from class Goal
adjustedTickDelay, getFlags, getServerLevel, getServerLevel, isInterruptable, reducedTickDelay, setFlags, toString
-
Field Details
-
mob
-
speedModifier
private final double speedModifier -
followingTargetEvenIfNotSeen
private final boolean followingTargetEvenIfNotSeen -
path
-
pathedTargetX
private double pathedTargetX -
pathedTargetY
private double pathedTargetY -
pathedTargetZ
private double pathedTargetZ -
ticksUntilNextPathRecalculation
private int ticksUntilNextPathRecalculation -
ticksUntilNextAttack
private int ticksUntilNextAttack -
attackInterval
private final int attackInterval- See Also:
-
lastCanUseCheck
private long lastCanUseCheck -
COOLDOWN_BETWEEN_CAN_USE_CHECKS
private static final long COOLDOWN_BETWEEN_CAN_USE_CHECKS- See Also:
-
-
Constructor Details
-
MeleeAttackGoal
public MeleeAttackGoal(PathfinderMob mob, double speedModifier, boolean followingTargetEvenIfNotSeen)
-
-
Method Details
-
canUse
-
canContinueToUse
public boolean canContinueToUse()- Overrides:
canContinueToUsein classGoal
-
start
-
stop
-
requiresUpdateEveryTick
public boolean requiresUpdateEveryTick()- Overrides:
requiresUpdateEveryTickin classGoal
-
tick
-
checkAndPerformAttack
-
resetAttackCooldown
protected void resetAttackCooldown() -
isTimeToAttack
protected boolean isTimeToAttack() -
canPerformAttack
-
getTicksUntilNextAttack
protected int getTicksUntilNextAttack() -
getAttackInterval
protected int getAttackInterval()
-