避爆 AI(avoid-explosions)
基本信息
| 属性 | 值 |
|---|---|
| 类名 | toast.specialAI.ai.EntityAIAvoidExplosions |
| 实例化 | AIHandler.onEntityJoinWorld 当 AVOID_EXPLOSIONS=true |
| 互斥位 | MOVEMENT + FACING |
| 优先级 | -1(高于基础 AI) |
功能
当 9×3×9 范围内存在以下危险实体时,使用 RandomPositionGenerator.findRandomTargetBlockAwayFrom 计算一个 16 格外的安全点,以 1.1 速度逃离;距离 < 8 格时加速到 1.3。
识别(EntitySelectorExploding)
EntityCreeper && creeperState > 0
EntityTNTPrimed
EntityLargeFireball
EntityWitherSkull
触发条件(shouldExecute)
- 附近有上述实体
findRandomTargetBlockAwayFrom返回非 null- 路径必须比当前位置离危险实体更远
isInterruptible() = false。
continueExecuting
- 路径仍存在
- 危险实体未
isDead