Iguana Skull 方块

本 mod 唯一注册的方块,用于承载 Iguana Skull 物品。

  • 注册名:skullBlock
  • 类:iguanaman.iguanatweakstconstruct.mobheads.blocks.IguanaSkullBlock → net.minecraft.block.BlockSkull
  • 方块名:iguana.tcon.skull(Reference.prefix("skull"))
  • 方块纹理:skull
  • 硬度:1.0
  • 踏步音:Block.soundTypePiston
  • TileEntity:iguanaman.iguanatweakstconstruct.mobheads.tileentities.IguanaSkullTileEntity → net.minecraft.tileentity.TileEntitySkull(注册名 skullTE)

实现说明

IguanaSkullTileEntity 是一个空类,不覆写任何成员;之所以需要它而不是直接用 TileEntitySkull,是为了让 IguanaSkullBlock.createNewTileEntity 能返回本 mod 自己的类型,从而与客户端自定义渲染器 IguanaTileEntitySkullRenderer 对应。

掉落

  • getItemDropped → 恒定返回 IguanaMobHeads.skullItem(注意忽略 metadata 参数)。
  • getDrops 覆写为:TileEntity 为 null 时返回空列表;否则返回 1 个 ItemStack(skullItem, 1, getDamageValue(world,x,y,z)),即掉落数量恒为 1、不吃时运(fortune)。
  • getItem → 恒定返回 IguanaMobHeads.skullItem。

本 mod 没有为本方块注册 ItemBlock(GameRegistry.registerItem 从未对 skullBlock 调用),因此头颅方块的物品形态是 Iguana Skull 而不是独立的方块物品。

第三方接口

类上标注 @Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.crafting.IInfusionStabiliser"),并以 @Optional.Method(modid = "Thaumcraft") 实现 canStabaliseInfusion 恒返回 true——即在装了神秘时代时,该头颅方块可作为注魔稳定器使用。未装神秘时代时整个接口实现被剥离,不产生硬依赖。

客户端渲染

IguanaTileEntitySkullRenderer 负责渲染,模型类为 ModelEnderManHead(末影人头)、ModelBucketHelmet(桶头盔)与 ModelHeadwear。通过 MobHeadClientProxy 装载,服务端不加载。