Package cn.nukkit.entity.ai.executor
Class ShootExecutor
java.lang.Object
cn.nukkit.entity.ai.executor.ShootExecutor
- All Implemented Interfaces:
EntityControl
,IBehaviorExecutor
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final int
用来射击的物品protected int
protected MemoryType<? extends Entity>
protected final int
protected float
protected Entity
用来指定特定的攻击目标. -
Constructor Summary
ConstructorDescriptionShootExecutor
(Supplier<Item> item, MemoryType<? extends Entity> memory, float speed, int maxShootDistance, boolean clearDataWhenLose, int coolDownTick, int pullBowTick) 射击执行器 -
Method Summary
Modifier and TypeMethodDescriptionprotected void
bowShoot
(ItemBow bow, EntityLiving entity) boolean
execute
(EntityIntelligent entity) 调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用void
onInterrupt
(EntityIntelligent entity) 行为非正常中断时(例如被更高级行为覆盖)调用void
onStop
(EntityIntelligent entity) 行为正常结束时(execute()方法返回false)调用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
-
Field Details
-
memory
-
speed
protected float speed -
maxShootDistanceSquared
protected int maxShootDistanceSquared -
clearDataWhenLose
protected boolean clearDataWhenLose -
coolDownTick
protected final int coolDownTick -
pullBowTick
protected final int pullBowTick -
target
用来指定特定的攻击目标.Used to specify a specific attack target.
-
item
用来射击的物品
-
-
Constructor Details
-
ShootExecutor
public ShootExecutor(Supplier<Item> item, MemoryType<? extends Entity> memory, float speed, int maxShootDistance, boolean clearDataWhenLose, int coolDownTick, int pullBowTick) 射击执行器- Parameters:
item
- the itemmemory
- 用于读取攻击目标的记忆
Used to read the memory of the attack targetspeed
- 移动向攻击目标的速度
The speed of movement towards the attacking targetmaxShootDistance
- 允许射击的最大距离,只有在这个距离内才能射击
The maximum distance at which it is permissible to shoot, and only at this distance can be firedclearDataWhenLose
- 失去目标时清空记忆
Clear your memory when you lose your targetcoolDownTick
- 攻击冷却时间(单位tick)
Attack cooldown (tick)pullBowTick
- 每次攻击动画用时(单位tick)
Attack Animation time(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
- 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
- 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
- Parameters:
entity
- 目标实体
-
bowShoot
-