Interface IBehaviorExecutor

All Known Subinterfaces:
IBehavior
All Known Implementing Classes:
AbstractBehavior, AnimalGrowExecutor, Behavior, EatGrassExecutor, EntityBreedingExecutor, EntityExplosionExecutor, EntityMoveToOwnerExecutor, FlatRandomRoamExecutor, InLoveExecutor, LookAtFeedingPlayerExecutor, LookAtTargetExecutor, MeleeAttackExecutor, MoveToTargetExecutor, MultipleExecutor, ShootExecutor, SleepOnOwnerBedExecutor, SpaceRandomRoamExecutor, TameHorseExecutor, WardenMeleeAttackExecutor, WardenRangedAttackExecutor, WardenSniffExecutor, WardenViolentAnimationExecutor, WeightedMultiBehavior, WolfAttackExecutor

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public interface IBehaviorExecutor
行为执行器
在实体上执行具体的行为
对于每个实例化的实体,此对象应只会实例化一次,且一直伴随实体不会改变

Behavior executor
Executes specific behavior on the entity
For each instantiated entity, this object should only be instantiated once, and the entity will not change all the time

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    调度器将会持续执行此执行器,直到返回false,或者执行器被中断
    此方法每gt都会调用
    default void
    行为非正常中断时(例如被更高级行为覆盖)调用
    default void
    行为评估成功后,进入激活状态前调用
    default void
    行为正常结束时(execute()方法返回false)调用
  • Method Details

    • execute

      boolean execute(EntityIntelligent entity)
      调度器将会持续执行此执行器,直到返回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

      Parameters:
      entity - 执行目标实体
      Returns:
      boolean
    • onInterrupt

      default void onInterrupt(EntityIntelligent entity)
      行为非正常中断时(例如被更高级行为覆盖)调用

      Called when behavior breaks abnormally (e.g. overridden by higher-level behavior)

      Parameters:
      entity - 目标实体
    • onStart

      default void onStart(EntityIntelligent entity)
      行为评估成功后,进入激活状态前调用

      After the behavior evaluation is successful, it is called before entering the active state

      Parameters:
      entity - 目标实体
    • onStop

      default void onStop(EntityIntelligent entity)
      行为正常结束时(execute()方法返回false)调用

      Called when the behavior ends normally (the execute() method returns false)

      Parameters:
      entity - 目标实体