Package cn.nukkit.entity.ai.executor
Class TameHorseExecutor
java.lang.Object
cn.nukkit.entity.ai.executor.FlatRandomRoamExecutor
cn.nukkit.entity.ai.executor.TameHorseExecutor
- All Implemented Interfaces:
EntityControl
,IBehaviorExecutor
@PowerNukkitXOnly
@Since("1.19.80-r3")
public class TameHorseExecutor
extends FlatRandomRoamExecutor
代表玩家驯服马时,马的行为
Represents the behavior of a horse when the player tames it
-
Field Summary
Fields inherited from class cn.nukkit.entity.ai.executor.FlatRandomRoamExecutor
avoidWater, calNextTargetImmediately, currentTargetCalTick, durationTick, frequency, maxRetryTime, maxRoamRange, runningTime, speed
-
Constructor Summary
ConstructorDescriptionTameHorseExecutor
(float speed, int maxRoamRange, int frequency) TameHorseExecutor
(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime) TameHorseExecutor
(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime, boolean avoidWater, int maxRetryTime, int tameProbability) Instantiates a new Flat random roam executor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
execute
(EntityIntelligent entity) 调度器将会持续执行此执行器,直到返回false,或者执行器被中断
此方法每gt都会调用void
onStart
(EntityIntelligent entity) 行为评估成功后,进入激活状态前调用void
onStop
(EntityIntelligent entity) 行为正常结束时(execute()方法返回false)调用Methods inherited from class cn.nukkit.entity.ai.executor.FlatRandomRoamExecutor
needUpdateTarget, next, onInterrupt, stop
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
-
Field Details
-
tameProbability
protected final int tameProbability
-
-
Constructor Details
-
TameHorseExecutor
public TameHorseExecutor(float speed, int maxRoamRange, int frequency) -
TameHorseExecutor
public TameHorseExecutor(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime) -
TameHorseExecutor
public TameHorseExecutor(float speed, int maxRoamRange, int frequency, boolean calNextTargetImmediately, int runningTime, boolean avoidWater, int maxRetryTime, int tameProbability) Instantiates a new Flat random roam executor.- Parameters:
speed
- 移动速度
Movement speedmaxRoamRange
- 随机行走目标点的范围
The range of the target point that is randomly walkedfrequency
- 更新目标点的频率
How often the target point is updatedcalNextTargetImmediately
- 是否立即选择下一个目标点,不管执行频率
Whether to select the next target point immediately, regardless of the frequency of executionrunningTime
- 马儿随机跑动的时间,跑动结束后会判断是否驯服成功
The time when the horse runs randomly, after the run, will judge whether the taming is successfulavoidWater
- 是否避开水行走
Whether to walk away from watermaxRetryTime
- 选取目标点的最大尝试次数
Pick the maximum number of attempts at the target pointtameProbability
- 马被驯服的概率(取值范围1-100)
Probability of a horse being tamed (value range 1-100)
-
-
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 classFlatRandomRoamExecutor
- 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 classFlatRandomRoamExecutor
- Parameters:
entity
- 目标实体
-
onStart
Description copied from interface:IBehaviorExecutor
行为评估成功后,进入激活状态前调用After the behavior evaluation is successful, it is called before entering the active state
- Parameters:
entity
- 目标实体
-