Class WolfAttackExecutor

java.lang.Object
cn.nukkit.entity.ai.executor.MeleeAttackExecutor
cn.nukkit.entity.ai.executor.WolfAttackExecutor
All Implemented Interfaces:
EntityControl, IBehaviorExecutor

@PowerNukkitXOnly @Since("1.19.30-r1") public class WolfAttackExecutor extends MeleeAttackExecutor
狼执行攻击,会带有狼的动画,以及攻击过程中狼还会看向携带食物的玩家.

The wolf performs an attack with a wolf animation, as well as during the attack the wolf will also look at the player carrying food.

  • Constructor Details

    • WolfAttackExecutor

      public WolfAttackExecutor(MemoryType<? extends Entity> memory, float speed, int maxSenseRange, boolean clearDataWhenLose, int coolDown)
      近战攻击执行器
      Parameters:
      memory - 记忆
      speed - 移动向攻击目标的速度
      maxSenseRange - 最大获取攻击目标范围
      clearDataWhenLose - 失去目标时清空记忆
      coolDown - 攻击冷却时间(单位tick)
  • Method Details

    • execute

      public boolean execute(EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      调度器将会持续执行此执行器,直到返回false,或者执行器被中断
      此方法每gt都会调用

      The scheduler will continue to execute this executor until it returns false or the executor is interrupted
      This method will be called every gt

      Specified by:
      execute in interface IBehaviorExecutor
      Overrides:
      execute in class MeleeAttackExecutor
      Parameters:
      entity - 执行目标实体
      Returns:
      boolean
    • onStop

      public void onStop(EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      行为正常结束时(execute()方法返回false)调用

      Called when the behavior ends normally (the execute() method returns false)

      Specified by:
      onStop in interface IBehaviorExecutor
      Overrides:
      onStop in class MeleeAttackExecutor
      Parameters:
      entity - 目标实体
    • onInterrupt

      public void onInterrupt(EntityIntelligent entity)
      Description copied from interface: IBehaviorExecutor
      行为非正常中断时(例如被更高级行为覆盖)调用

      Called when behavior breaks abnormally (e.g. overridden by higher-level behavior)

      Specified by:
      onInterrupt in interface IBehaviorExecutor
      Overrides:
      onInterrupt in class MeleeAttackExecutor
      Parameters:
      entity - 目标实体