Unstable Ice Core(不稳定冰核)

事实基准:/Users/evlos/a/mirror/twilightforest(minecraftVersion = 1.7.10)逐行读源码。

基本信息

属性 值 来源
注册实体名 TwilightForest:Unstable Ice Core TwilightForestMod.java:717-722
实体 ID 常量 idMobUnstableIceCore = 230 TwilightForestMod.java:1132
类 twilightforest.entity.EntityTFIceExploder entity/EntityTFIceExploder.java(273 行)
父类 net.minecraft.entity.monster.EntityMob 同上 :26
尺寸 setSize(0.8F, 1.8F) 同上 :40
蛋色 主 0x9aacf5 / 副 0x9b0fa5 TwilightForestMod.java:721-722
所属结构 冰霜高塔(iceTower 特性 ID 7) TFFeature.java:200

类名 EntityTFIceExploder 与注册名 Unstable Ice Core 不一致,查询请用注册名。

数值

属性 值 来源
maxHealth 源码中未设置(无 applyEntityAttributes 中的 maxHealth 赋值),沿用 EntityMob 默认 —
movementSpeed 0.23 EntityTFIceExploder.java:45
attackDamage 3.0 同上 :46
爆炸威力 EXPLOSION_RADIUS 1 同上 :28
爆炸触发时刻 deathTime == 60 同上 :128
方块转化半径 range 4 同上 :171
每区块生成上限 8 同上 :270-272

生成权重

TFFeature.java:200:iceTower.addMonster(EntityTFIceExploder.class, 5, 4, 4) —— 权重 5,是同塔 Stable Ice Core(权重 10,:199)的一半。

AI 行为 / 特殊机制

isAIEnabled() 恒为 true(:52-54)。任务表(:33-39):

优先级 任务 行号
0 EntityAISwimming :33
1 EntityAIAttackOnCollide(EntityPlayer, 1.0D, false) :34
2 EntityAIWander(this, 1.0D) :35
3 EntityAIWatchClosest(EntityPlayer, 8.0F) :36
3 EntityAILookIdle :37

targetTasks:EntityAIHurtByTarget(优先级 1)与 EntityAINearestAttackableTarget(EntityPlayer, 0, true)(优先级 2)(:38-39)。

死亡爆炸:覆写 onDeathUpdate()(:125-168),在 deathTime == 60 时:

  1. 读游戏规则 mobGriefing(:131),以 EXPLOSION_RADIUS = 1 调用 createExplosion(:132-133)。
  2. 只有 mobGriefing = true 时才调 detonate() 做方块转化(:135-137)。
  3. 照抄原版经验球结算:非客户端、被玩家击中或本身是玩家、且 doMobLoot 开启时 掉落经验球(:139-150)。
  4. setDead() + 20 个 explode 粒子(:152-166)。

方块转化(detonate() :170-190):以自身为中心 range = 4 的立方体, 对距离 < range + rand(-1,1)*2 的方块调 transformBlock。 transformBlock(:192-221)只处理 getExplosionResistance < 8F 且 getBlockHardness >= 0 的方块,并按原方块颜色找最接近的羊毛色(getMetaForColor, :242-265):

条件 变为 行号
shouldTransformGlass:非空气、完整 1×1×1 包围盒、且(材质非不透明 或 是树叶 或 Blocks.ice 或 TFBlocks.auroraBlock) Blocks.stained_glass :215-216、:227-232
shouldTransformClay:block.isNormalCube(...) Blocks.stained_hardened_clay :217-218、:223-225

粒子:每 tick 3 个 snowguardian 粒子(:67-85)。

掉落:getDropItem() 返回 Items.snowball(:59-61)——原版雪球。 不掉落 TwilightForest 物品,也不掉 trophy。

音效:mob.ice.noise / mob.ice.hurt / mob.ice.death(:88-104)。

成就:暮色森林维度玩家击杀触发 twilightHunter(:113-120)。

相关条目