Package cn.nukkit.entity.ai.executor
Class WolfAttackExecutor
java.lang.Object
cn.nukkit.entity.ai.executor.MeleeAttackExecutor
cn.nukkit.entity.ai.executor.WolfAttackExecutor
- All Implemented Interfaces:
EntityControl
,IBehaviorExecutor
狼执行攻击,会带有狼的动画,以及攻击过程中狼还会看向携带食物的玩家.
The wolf performs an attack with a wolf animation, as well as during the attack the wolf will also look at the player carrying food.
-
Field Summary
Fields inherited from class cn.nukkit.entity.ai.executor.MeleeAttackExecutor
attackTick, clearDataWhenLose, coolDown, effects, lookTarget, maxSenseRangeSquared, memory, oldTarget, speed, target
-
Constructor Summary
ConstructorDescriptionWolfAttackExecutor
(MemoryType<? extends Entity> memory, float speed, int maxSenseRange, boolean clearDataWhenLose, int coolDown) 近战攻击执行器 -
Method Summary
Modifier and TypeMethodDescriptionboolean
execute
(EntityIntelligent entity) 调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用void
onInterrupt
(EntityIntelligent entity) 行为非正常中断时(例如被更高级行为覆盖)调用void
onStop
(EntityIntelligent entity) 行为正常结束时(execute()方法返回false)调用Methods inherited from class cn.nukkit.entity.ai.executor.MeleeAttackExecutor
playAttackAnimation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.entity.ai.executor.EntityControl
removeLookTarget, removeRouteTarget, setLookTarget, setRouteTarget
Methods inherited from interface cn.nukkit.entity.ai.executor.IBehaviorExecutor
onStart
-
Constructor Details
-
WolfAttackExecutor
public WolfAttackExecutor(MemoryType<? extends Entity> memory, float speed, int maxSenseRange, boolean clearDataWhenLose, int coolDown) 近战攻击执行器- Parameters:
memory
- 记忆speed
- 移动向攻击目标的速度maxSenseRange
- 最大获取攻击目标范围clearDataWhenLose
- 失去目标时清空记忆coolDown
- 攻击冷却时间(单位tick)
-
-
Method Details
-
execute
Description copied from interface:IBehaviorExecutor
调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用The scheduler will continue to execute this executor until it returns false or the executor is interrupted
This method will be called every gt- Specified by:
execute
in interfaceIBehaviorExecutor
- Overrides:
execute
in classMeleeAttackExecutor
- Parameters:
entity
- 执行目标实体- Returns:
- boolean
-
onStop
Description copied from interface:IBehaviorExecutor
行为正常结束时(execute()方法返回false)调用Called when the behavior ends normally (the execute() method returns false)
- Specified by:
onStop
in interfaceIBehaviorExecutor
- Overrides:
onStop
in classMeleeAttackExecutor
- Parameters:
entity
- 目标实体
-
onInterrupt
Description copied from interface:IBehaviorExecutor
行为非正常中断时(例如被更高级行为覆盖)调用Called when behavior breaks abnormally (e.g. overridden by higher-level behavior)
- Specified by:
onInterrupt
in interfaceIBehaviorExecutor
- Overrides:
onInterrupt
in classMeleeAttackExecutor
- Parameters:
entity
- 目标实体
-