Files
netease-modsdk-wiki/docs/mcguide/20-玩法开发/15-自定义游戏内容/2-自定义方块/3-特殊方块/4-自定义红石方块.md
2025-03-17 13:24:39 +08:00

68 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
front:
hard: 入门
time: 分钟
---
# 自定义红石方块
自定义红石方块是一种特殊的自定义方块,包括信号源方块与红石机械元件方块,支持方块相关的所有事件以及接口。
## 自定义红石信号源方块
自定义红石信号源方块放置在地图上会发出红石信号,信号的初始值可以配置。
其中type为producerstrength为初始红石信号量。
```json
{
"format_version": "1.10.0",
"minecraft:block": {
"description": {
"identifier": "customblocks:customblocks_redstone",
"register_to_creative_menu": true,
"is_experimental": false,
},
"components": {
"minecraft:map_color": {
"color": "#408080"
},
"netease:redstone": {
"type": "producer",
"strength": 10
}
}
}
}
```
## 自定义红石机械元件方块
自定义红石机械元件方块放置在地图上会接收红石信号,可以被激活。
对于自定义红石机械元件方块,其红石信号变化时触发事件<a href="../../../../../mcdocs/1-ModAPI/事件/方块.html#blockstrengthchangedserverevent" rel="noopenner"> BlockStrengthChangedServerEvent </a>。
其中type为consumer初始红石信号量为0未激活状态不能通过netease:redstone的strength字段进行配置。
```json
{
"format_version": "1.10.0",
"minecraft:block": {
"description": {
"identifier": "customblocks:customblocks_redstone_consumer",
"register_to_creative_menu": true,
"is_experimental": false,
},
"components": {
"netease:redstone": {
"type": "consumer"
}
}
}
}
```