跳斩(ai-leap)

基本信息

属性 值
类名 toast.specialAI.ai.special.EntityAILeap
实现接口 ISpecialAI
名称 leap
默认权重 1
默认存值 byte 1
互斥位 (未设置)
优先级 0

功能

实体接近玩家时跳到玩家正上方高空(motionY = 0.8,按距离平方缩放)砸下,落地造成 4 点摔落伤害。落地后 setSprinting(true) 朝目标冲刺。

触发条件(shouldExecute)

  • 实体在地面
  • 目标存在
  • distance² ≤ 16(近距离)
  • nextInt(20) == 0

startExecuting

theEntity.getJumpHelper().setJumping();
double scale = 1.0 - distanceSq / 16.0;
theEntity.motionY = 0.8 * scale + 0.2;
theEntity.motionX = (target.posX - theEntity.posX) * 0.25 * scale;
theEntity.motionZ = (target.posZ - theEntity.posZ) * 0.25 * scale;

continueExecuting

false(一击脱离型,落地后本 AI 自动结束)。

初始化(initialize)

  • 主手位(0)装备带 30 级随机附魔 + Power 等级 5 的弓

落地效果(updateTask)

onGround 且 fallDistance > 0 时给目标造成 4 点 fall 伤害,setSprinting(true)。

相关条目