Igniter
基本信息
| 属性 | 值 |
|---|---|
| 注册名 | TMechworks:redstoneMachine |
| metadata | 1 |
| 方块类 | RedstoneMachine(与 Drawbridge 同一方块类) |
| TileEntity | FirestarterLogic(TileEntity,实现 IFacingLogic / IActiveLogic) |
| TE 槽数 | 0(不继承 InventoryLogic) |
| 材质 | Material.iron |
| 硬度 | 12(继承 RedstoneMachine 构造器) |
| 步声 | soundTypeMetal |
| 亮度 | 0(getLightValue 只在 metadata 0/2 生效,meta 1 走 super) |
| GUI | 无(getGui 的 switch 不含 case 1,返回 null) |
| 贴图 | firestarter_top / firestarter_side / firestarter_bottom(索引 6-8) |
功能
红石控制的单格点火器。红石激活时在面朝方向的相邻 1 格放置 Blocks.fire;取消激活时若该格是火则换成空气。
FirestarterLogic.setFire()(blocks/logic/FirestarterLogic.java:42-98)按 direction 偏移一格:
| direction | 目标偏移 | 实际朝向 |
|---|---|---|
| 0 | y - 1 |
上 |
| 1 | y + 1 |
下 |
| 2 | z - 1 |
北 |
| 3 | z + 1 |
南 |
| 4 | x - 1 |
西 |
| 5 | x + 1 |
东 |
只有目标格是空气时才点火(WorldHelper.isAirBlock),播 fire.ignite 音效(1.0F,音调 AbilityHelper.random.nextFloat() * 0.4F + 0.8F)。熄灭分支播的也是 fire.ignite 而非 random.fizz —— 源码中 random.fizz 那一行被注释掉了(:84-85)。
updateEntity 只在 shouldActivate 为真时执行一次 setFire(),随即置回 false(:100-105)—— 即边沿触发而非每 tick 持续。
数值
| 数值 | 值 |
|---|---|
| metadata | 1 |
| 作用距离 | 1 格 |
| 作用方向 | direction 单一面(6 值) |
| TE 槽数 | 0 |
| 点火条件 | 目标格为空气 |
| 熄灭条件 | 目标格 == Blocks.fire |
| 触发方式 | 边沿(shouldActivate 标志) |
| 点火音效 | fire.ignite 1.0F,音调 0.8–1.2 随机 |
| 熄灭音效 | 同为 fire.ignite(random.fizz 被注释) |
| GUI | 无 |
| 硬度 | 12 |
| 贴图索引 | getTextureIndex(side) + 6 |
| NBT | Active(boolean)、Direction(byte) |
| 描述包 | S35PacketUpdateTileEntity(x, y, z, 1, tag) |
交互
| 触发 | 行为 |
|---|---|
| 红石脉冲 | setActive(true) → shouldActivate = true → 下次 updateEntity 点火 |
| 红石撤除 | setActive(false) → 下次 updateEntity 熄火 |
| 放置时朝向 | setDirection(yaw, pitch, player):俯视 → 1,仰视 → 0,否则按 yaw → 2/5/3/4 |
| 右键 | 无 GUI(getGui 返回 null) |
配方
common/MechRecipes.java:51-66,1 条:
a c a
# d #
# r #
| 符号 | 材料 |
|---|---|
# |
ingotBronze × 4 |
a |
ingotAluminumBrass × 2 |
c |
heavyPlate meta 7(largePlate) |
r |
minecraft:redstone × 1 |
d |
minecraft:flint_and_steel × 1 |
TCon 手册另有 1 条 registerManualLargeRecipe("igniter", ...)(common/MechContent.java:170-181),c 同样是 largePlate meta 7,d 是 flint_and_steel。
源码缺陷
- 熄灭音效错误:熄灭时播
fire.ignite(点火音)而非random.fizz(熄灭音),源码中正确的那行被注释(blocks/logic/FirestarterLogic.java:84-85)。 readFromNBT/writeToNBT方向写反(:149-160):
两个方法的读写方向互换。readFromNBT(tags) → tags.setBoolean("Active", active); // 把字段写进传入的 NBT writeToNBT(tags) → active = tags.getBoolean("Active"); // 从传入的 NBT 读回字段
super.readFromNBT/super.writeToNBT已正确处理xCoord/yCoord/zCoord,但Active状态在存盘时被super.writeToNBT之后立刻被tags.getBoolean覆盖回旧值 —— 重启后active状态丢失(表现为机器回到未激活,需重新给红石)。Direction走readCustomNBT/writeCustomNBT,方向正确。setDirection(int side)空实现(:118),同 Drawbridge。putOut字段被注释掉(:22、:34、:70、:82、:94)—— 原设计有「熄灭后延时」的意图,未实现。- 无 GUI 意味着无法手动激活/调整朝向;放置朝向只能靠放置时的玩家视角。
setFire()在客户端也会执行:updateEntity未判worldObj.isRemote,setFire()内的worldObj.setBlock双端调用(服务端权威,客户端预测)。
相关条目
- Drawbridge - 同一方块 ID 的 meta 0
- Advanced Drawbridge - 同一方块 ID 的 meta 2
- Drawbridge GUI - 不适用于本条目(Igniter 无 GUI)