吃育种物品 AI(eat-breeding-item)
基本信息
| 属性 | 值 |
|---|---|
| 类名 | toast.specialAI.ai.grief.EntityAIEatBreedingItem |
| 实例化 | AIHandler.onEntityJoinWorld 当 EAT_BREEDING_ITEMS=true 且实体是 EntityAnimal |
| 互斥位 | MOVEMENT + FACING |
| 优先级 | 与 wander/watch/lookIdle 同级(getPassivePriority) |
功能
每 30+ tick 在 16×8×16 范围内随机扫描一个可育种物品 EntityItem(isBreedingItem(...) 为 true),走过去吃掉。可选回血(eating_heals=true 默认):
healAmount = stack.stackSize;
if (item instanceof ItemFood) healAmount *= item.func_150905_g(item);
entity.heal(healAmount);
吃掉时播放 random.burp(音量 0.5,pitch 0.9~1.0)。冷却:失败上限 400 tick。
触发条件(shouldExecute)
- 未骑乘
- 游戏规则
mobGriefing = true ++checkTime > 30(每 30+ tick 重检)findNearbyFood()找到目标
continueExecuting
- 未骑乘
- 目标仍存活且仍是育种物品
- 路径未丢失
- 失败上限未到(
giveUpDelay < 400)