Class ConditionalProbabilityEvaluator

java.lang.Object
cn.nukkit.entity.ai.evaluator.ProbabilityEvaluator
cn.nukkit.entity.ai.evaluator.ConditionalProbabilityEvaluator
All Implemented Interfaces:
IBehaviorEvaluator

@PowerNukkitXOnly @Since("1.19.30-r1") public class ConditionalProbabilityEvaluator extends ProbabilityEvaluator
  • Constructor Details

    • ConditionalProbabilityEvaluator

      public ConditionalProbabilityEvaluator(int probability1, int probability2, Function<Entity,Boolean> condition, int total)
  • Method Details

    • evaluate

      public boolean evaluate(EntityIntelligent entity)
      Description copied from interface: IBehaviorEvaluator
      是否需要激活与其绑定的执行器

      这个方法对一个行为只会评估一次,评估通过则开始运行执行器执行行为,直到行为中断或者完成,下一次评估才会开始

      Whether the executor bound to it needs to be activated

      This method evaluates a behavior only once, and if the evaluation passes, the executor execution behavior will start running until the behavior is interrupted or completed, and the next evaluation will not begin

      Specified by:
      evaluate in interface IBehaviorEvaluator
      Overrides:
      evaluate in class ProbabilityEvaluator
      Parameters:
      entity - 评估目标实体
      Assess the targetEntity
      Returns:
      是否需要激活
      Do you need to activate