Class EntityMoveToOwnerExecutor

java.lang.Object
cn.nukkit.entity.ai.executor.EntityMoveToOwnerExecutor
All Implemented Interfaces:
EntityControl, IBehaviorExecutor

@PowerNukkitXOnly @Since("1.19.30-r1") public class EntityMoveToOwnerExecutor extends Object implements EntityControl, IBehaviorExecutor
实体移动到主人身边.(只对实现了接口 EntityTamable 的实体有效)

The entity moves to the master's side.(Only valid for entities that implement the interface EntityTamable)

  • Field Details

    • speed

      protected float speed
    • maxFollowRangeSquared

      protected int maxFollowRangeSquared
    • oldTarget

      protected Vector3 oldTarget
    • updateRouteImmediatelyWhenTargetChange

      protected boolean updateRouteImmediatelyWhenTargetChange
  • Constructor Details

    • EntityMoveToOwnerExecutor

      public EntityMoveToOwnerExecutor(float speed, boolean updateRouteImmediatelyWhenTargetChange, int maxFollowRange)
  • Method Details

    • execute

      public boolean execute(@NotNull EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      调度器将会持续执行此执行器,直到返回false,或者执行器被中断
      此方法每gt都会调用
      Specified by:
      execute in interface IBehaviorExecutor
      Parameters:
      entity - 执行目标实体
      Returns:
      boolean
    • onInterrupt

      public void onInterrupt(EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      行为非正常中断时(例如被更高级行为覆盖)调用
      Specified by:
      onInterrupt in interface IBehaviorExecutor
      Parameters:
      entity - 目标实体
    • onStop

      public void onStop(EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      行为正常结束时(execute()方法返回false)调用
      Specified by:
      onStop in interface IBehaviorExecutor
      Parameters:
      entity - 目标实体
    • randomVector3

      protected Vector3 randomVector3(Entity player, int r)