ModItems

基本信息

属性 值
类名 remoteio.common.lib.ModItems
字段 11 个 Item 静态字段,实际注册 9 个
注册域 RIO(modid)

注册的 9 个物品

字段 注册名(unlocalized) 类
locationChip chip.location ItemLocationChip
transferChip chip.transfer ItemTransferChip
upgradeChip chip.upgrade ItemUpgradeChip
blankPlate blank_plate ItemBlankPlate
ioTool io_tool ItemIOTool
wirelessTransmitter wireless_transmitter ItemWirelessTransmitter
pda pda ItemPDA
remoteAccessor remoteAccessor ItemRemoteAccessor
linker linker ItemLinker

2 个从未实例化的死字段

字段 状况
interactionInhibitor ⚠️ 声明但 initialize() 中没有赋值,运行时恒为 null
wirelessLocationChip ⚠️ 声明但 initialize() 中没有赋值,运行时恒为 null
  • interactionInhibitor 的类 ItemInteractionInhibitor 存在且实现完整, 但没有任何地方 new 它(全仓只有类自身的构造与该物品的 Item 子类化)。
  • 但 PlayerEventHandler.java:25 与 RecipeInhibitorApply:25,42 都在做 itemStack.getItem() == ModItems.interactionInhibitor 的比较—— 拿一个恒为 null 的引用作比较,这两处判断永远为 false。
  • wirelessLocationChip 只有 Documentation:57-58 的文档页 提到它,同样没有实现。

实现要点

  • 注册用私有辅助方法 register(Item),内部 GameRegistry.registerItem(item, item.getUnlocalizedName()), 即注册名就是 unlocalizedName。
  • ⚠️ 9 个注册名中 remoteAccessor 是驼峰,其余全是蛇形或点分,命名不统一。
  • chip.transfer / chip.upgrade 用 meta 区分变体(见 TransferType、 UpgradeType),因此这两个物品是「一个物品 N 个变体」而非多个物品。

相关条目