Interface IBehaviorGroup

All Known Implementing Classes:
BehaviorGroup, EmptyBehaviorGroup

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public interface IBehaviorGroup
行为组是一个基本的、独立的AI单元
它由若干个(核心)行为IBehavior、控制器IController、传感器ISensor以及一个寻路器IRouteFinder和记忆存储器IMemoryStorage组成br> 注:核心行为指的是不会被行为优先级影响的行为,其激活状态只取决于其自身的评估器br>

A Behavior Group is a basic, self-contained unit of AI
that consists of several (core) BehaviorsIBehavior, ControllersIController, SensorsISensor and a PathfinderIRouteFinder and memory IMemoryStorage are composed
Note: Core behavior refers to the behavior that will not be affected by the priority of the behavior, and its activation status only depends on its own evaluator

  • Method Details

    • evaluateBehaviors

      void evaluateBehaviors(EntityIntelligent entity)
      调用行为组内部的所有行为IBehavior的评估器IBehaviorEvaluator

      Call the evaluator IBehaviorEvaluator of all behavior IBehavior inside the behavior group

      Parameters:
      entity - 目标实体对象
    • evaluateCoreBehaviors

      void evaluateCoreBehaviors(EntityIntelligent entity)
      调用行为组内部的所有核心行为IBehavior的评估器IBehaviorEvaluator

      Call the evaluator IBehaviorEvaluator of all core behavior IBehavior inside the behavior group

      Parameters:
      entity - 目标实体对象
    • collectSensorData

      void collectSensorData(EntityIntelligent entity)
      调用行为组内部的所有传感器ISensor,并将传感器返回的记忆数据写入到记忆存储器中IMemoryStorage

      Call all sensors ISensor inside the behavior group, and write the memory data returned by the sensor to the memory storage IMemoryStorage

      Parameters:
      entity - 目标实体对象
    • tickRunningBehaviors

      void tickRunningBehaviors(EntityIntelligent entity)
      调用行为组内部所有被激活的行为IBehavior的执行器IBehaviorExecutor

      Call the executor IBehaviorExecutor of all activated behavior IBehavior inside the behavior group

      Parameters:
      entity - 目标实体对象
    • tickRunningCoreBehaviors

      void tickRunningCoreBehaviors(EntityIntelligent entity)
      调用行为组内部所有被激活的核心行为IBehavior的执行器IBehaviorExecutor

      Call the executor IBehaviorExecutor of all activated core behavior IBehavior inside the behavior group

      Parameters:
      entity - 目标实体对象
    • applyController

      void applyController(EntityIntelligent entity)
      应用行为内部所有的控制器IController

      All controllers inside the application behaviorIController

      Parameters:
      entity - 目标实体对象
    • getBehaviors

      Set<IBehavior> getBehaviors()
      Returns:
      行为组包含的行为 IBehavior
      Behaviors contained in Behavior Groups IBehavior
    • getCoreBehaviors

      Set<IBehavior> getCoreBehaviors()
      Returns:
      行为组包含的核心行为 IBehavior
      Core Behaviors Contained by Behavior Groups IBehavior
    • getRunningBehaviors

      Set<IBehavior> getRunningBehaviors()
      Returns:
      被激活的行为 IBehavior
      Activated Behavior IBehavior
    • getRunningCoreBehaviors

      Set<IBehavior> getRunningCoreBehaviors()
      Returns:
      被激活的核心行为 IBehavior
      Activated Core Behavior IBehavior
    • getSensors

      Set<ISensor> getSensors()
      Returns:
      行为组包含的传感器 ISensor
      Behavior group includes sensors ISensor
    • getControllers

      Set<IController> getControllers()
      Returns:
      行为组包含的控制器 IController
      Behavior group contains the controller IController
    • getRouteFinder

      IRouteFinder getRouteFinder()
      Returns:
      行为组使用的寻路器 IRouteFinder
      Routefinder used by behavior groups IRouteFinder
    • updateRoute

      void updateRoute(EntityIntelligent entity)
      通过行为组使用的寻路器更新当前位置到目标位置路径

      Update the path from the current position to the target position through the pathfinder used by the behavior group

      Parameters:
      entity - 目标实体
    • getMemoryStorage

      IMemoryStorage getMemoryStorage()
      Returns:
      行为组的记忆存储器 IMemoryStorage
      Behavior Group Memory Storage IMemoryStorage
    • isForceUpdateRoute

      boolean isForceUpdateRoute()
      Returns:
      下一gt是否强制更新路径
      Whether the next gt is forced to update the path
    • setForceUpdateRoute

      void setForceUpdateRoute(boolean forceUpdateRoute)
      要求下一gt立即更新路径

      Ask the next gt to update the path immediately

      Parameters:
      forceUpdateRoute - 立即更新路径
    • debugTick

      default void debugTick(EntityIntelligent entity)
      当 EntityAI.checkDebugOption(BEHAVIOR) == true 时此方法每1gt调用一次,用于debug模式相关内容的刷新

      When EntityAI.checkDebugOption(BEHAVIOR) == true, this method is called every 1gt to refresh the content related to debug mode

    • save

      @Since("1.19.63-r1") default void save(EntityIntelligent entity)