💡 可切换灯方块
可切换灯方块通过切换 lit 属性控制亮灭状态。可由红石、手动交互或两者共同控制。
- 红石: 每当方块从未充能变为充能时,
lit状态会翻转一次。powered属性用于记录当前是否受到红石信号。 - 手动交互: 当
can_open_with_hand启用时,玩家可右键直接切换lit状态。
属性
| 属性名称 | 属性类型 | 是否必需 |
|---|---|---|
| lit | boolean | 是 |
| powered | boolean | 否* |
* 当 can_open_with_hand 为 false 时必需;为 true 时可选。
示例
blocks:
default:copper_coil:
behavior:
type: toggleable_lamp_block
can_open_with_hand: false # 允许右键点击切换(默认 false)
