Interface IBehavior

All Superinterfaces:
IBehaviorEvaluator, IBehaviorExecutor
All Known Implementing Classes:
AbstractBehavior, Behavior, WeightedMultiBehavior

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public interface IBehavior extends IBehaviorExecutor, IBehaviorEvaluator
此接口抽象了一个行为对象,作为行为组IBehaviorGroup的组成部分.

This interface abstracts a behavior object as part of the behavior group IBehaviorGroup.

  • Method Summary

    Modifier and Type
    Method
    Description
     
    default int
    返回此行为的刷新周期,小的刷新周期会使得评估器被更频繁的调用 注意此方法只会影响评估器的调用,而不会影响执行器的调用
    default int
    返回此行为的优先级,高优先级的行为会覆盖低优先级的行为
    default int
    返回此行为的权重值,高权重的行为有更大几率被选中
    void
    设置此行为的状态

    Methods inherited from interface cn.nukkit.entity.ai.evaluator.IBehaviorEvaluator

    evaluate

    Methods inherited from interface cn.nukkit.entity.ai.executor.IBehaviorExecutor

    execute, onInterrupt, onStart, onStop
  • Method Details

    • getPriority

      default int getPriority()
      返回此行为的优先级,高优先级的行为会覆盖低优先级的行为
      Returns:
      优先级
    • getWeight

      default int getWeight()
      返回此行为的权重值,高权重的行为有更大几率被选中
      Returns:
      权重值
    • getPeriod

      default int getPeriod()
      返回此行为的刷新周期,小的刷新周期会使得评估器被更频繁的调用 注意此方法只会影响评估器的调用,而不会影响执行器的调用
      Returns:
      刷新周期
    • getBehaviorState

      BehaviorState getBehaviorState()
      Returns:
      此行为当前的状态
    • setBehaviorState

      void setBehaviorState(BehaviorState state)
      设置此行为的状态
      Parameters:
      state - 状态