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 the priority of this behavior, with higher-priority behaviors overriding lower-priority ones

      Returns:
      优先级
    • getWeight

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

      Returns the weight value of the behavior, with higher weights having a higher chance of being selected

      Returns:
      权重值
    • getPeriod

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

      Returns the refresh period for this behavior, a small refresh period will cause the evaluator to be called more often. Note that this method only affects evaluator calls, not executor calls.

      Returns:
      刷新周期
      Refresh period
    • getBehaviorState

      BehaviorState getBehaviorState()
      Returns:
      此行为当前的状态
      The current state of this behavior
    • setBehaviorState

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

      Set the status of this behavior

      Parameters:
      state - 状态