ModBlocks
基本信息
| 属性 | 值 |
|---|---|
| 类名 | remoteio.common.lib.ModBlocks |
| 字段 | 6 个 Block 静态字段,实际注册 5 个 |
| 注册域 | RIO(modid) |
注册的 5 个方块
| 字段 | 注册名 | 构造 | TileEntity | ItemBlock |
|---|---|---|---|---|
remoteInterface |
remote_interface |
BlockRemoteInterface | TileRemoteInterface | 无 |
remoteInventory |
remote_inventory |
BlockRemoteInventory | TileRemoteInventory | ItemBlockRemoteInventory |
machine |
machine |
BlockMachine | meta 0 = TileMachineReservoir,meta 1 = TileMachineHeater | ItemBlockMulti({reservoir, heater}) |
skylight |
skylight |
BlockSkylight | 无 | 无 |
intelligentWorkbench |
intelligentWorkbench |
BlockIntelligentWorkbench | TileIntelligentWorkbench | 无 |
未注册的 transceiver
ModBlocks.java:57-61 有一段被 /* */ 注释掉的代码:
/* transceiver = new BlockTransceiver().setBlockName("transceiver"); GameRegistry.registerBlock(transceiver,
* ItemBlockTransceiver.class, "transceiver"); GameRegistry.registerTileEntity(TileTransceiver.class,
* "remoteio:transceiver");
*/
[!WARNING]
transceiver字段声明了但永远为null。被注释的BlockTransceiver、ItemBlockTransceiver、TileTransceiver三个类在仓库中根本不存在——find src -iname '*Transceiver*'只命中assets/remoteio/models/transceiver.obj与.mtl两个模型文件。 即模型资源残留,代码已删除。
实现要点
remoteInterface的渲染 ID 在 RemoteIO 的preInit里 用RenderingRegistry.getNextAvailableRenderId()单独分配。skylight用GameRegistry.registerBlock(skylight, "skylight")的两参重载, 即没有 ItemBlock,在物品栏中不可得。machine用四参registerBlock+Object[]{"reservoir","heater"}提供两个子名。
相关条目
- RemoteIO - 调用方
- BlockMachine - 唯一的多 meta 方块
- BlockSkylight - 唯一无 TileEntity 且无 ItemBlock 的方块
- ItemBlockMulti - machine 的 ItemBlock