Class EntityIntelligent

All Implemented Interfaces:
EntityAsyncPrepare, EntityDamageable, EntityNameable, Metadatable, Cloneable
Direct Known Subclasses:
EntityAnimal, EntityMob

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public abstract class EntityIntelligent extends EntityPhysical
EntityIntelligent抽象了一个具有行为组IBehaviorGroup(也就是具有AI)的实体
  • Field Details

    • EMPTY_BEHAVIOR_GROUP

      public static final IBehaviorGroup EMPTY_BEHAVIOR_GROUP
    • isActive

      protected boolean isActive
      是否为活跃实体,如果实体不活跃,就应当降低AI运行频率
    • lookTarget

      protected Vector3 lookTarget
    • moveTarget

      protected Vector3 moveTarget
    • moveDirectionStart

      protected Vector3 moveDirectionStart
    • moveDirectionEnd

      protected Vector3 moveDirectionEnd
    • needUpdateMoveDirection

      protected boolean needUpdateMoveDirection
    • enablePitch

      protected boolean enablePitch
  • Constructor Details

  • Method Details

    • getBehaviorGroup

      public IBehaviorGroup getBehaviorGroup()
      返回此实体持有的行为组IBehaviorGroup
      默认实现只会返回一个空行为EmptyBehaviorGroup常量,若你想让实体具有AI,你需要覆写此方法
      Returns:
      此实体持有的行为组
    • onUpdate

      public boolean onUpdate(int currentTick)
      Overrides:
      onUpdate in class EntityPhysical
    • asyncPrepare

      public void asyncPrepare(int currentTick)
      我们将行为组运行循环的部分工作并行化以提高性能
      Specified by:
      asyncPrepare in interface EntityAsyncPrepare
      Overrides:
      asyncPrepare in class EntityPhysical
      Parameters:
      currentTick - 当前游戏刻
    • attack

      public boolean attack(EntityDamageEvent source)
      Overrides:
      attack in class EntityLiving
    • getMemoryStorage

      @Nullable public IMemoryStorage getMemoryStorage()
    • getJumpingHeight

      public float getJumpingHeight()
      返回实体最大的跳跃高度,返回值会用在移动处理上
      Returns:
      实体最大跳跃高度
      See Also:
    • hasMoveDirection

      public boolean hasMoveDirection()
    • enableHeadYaw

      @Since("1.6.0.0-PNX") public boolean enableHeadYaw()
      Overrides:
      enableHeadYaw in class Entity
    • isActive

      public boolean isActive()
      是否为活跃实体,如果实体不活跃,就应当降低AI运行频率
    • getLookTarget

      public Vector3 getLookTarget()
    • getMoveTarget

      public Vector3 getMoveTarget()
    • getMoveDirectionStart

      public Vector3 getMoveDirectionStart()
    • getMoveDirectionEnd

      public Vector3 getMoveDirectionEnd()
    • isNeedUpdateMoveDirection

      public boolean isNeedUpdateMoveDirection()
    • isEnablePitch

      public boolean isEnablePitch()
    • setActive

      public void setActive(boolean isActive)
      是否为活跃实体,如果实体不活跃,就应当降低AI运行频率
    • setLookTarget

      public void setLookTarget(Vector3 lookTarget)
    • setMoveTarget

      public void setMoveTarget(Vector3 moveTarget)
    • setMoveDirectionStart

      public void setMoveDirectionStart(Vector3 moveDirectionStart)
    • setMoveDirectionEnd

      public void setMoveDirectionEnd(Vector3 moveDirectionEnd)
    • setNeedUpdateMoveDirection

      public void setNeedUpdateMoveDirection(boolean needUpdateMoveDirection)
    • setEnablePitch

      public void setEnablePitch(boolean enablePitch)