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

1.5 KiB
Raw Blame History

front, hard, time
front hard time
入门 分钟

自定义红石方块

自定义红石方块是一种特殊的自定义方块,包括信号源方块与红石机械元件方块,支持方块相关的所有事件以及接口。

自定义红石信号源方块

自定义红石信号源方块放置在地图上会发出红石信号,信号的初始值可以配置。

其中type为producerstrength为初始红石信号量。

{
    "format_version": "1.10.0",
    "minecraft:block": {
        "description": {
            "identifier": "customblocks:customblocks_redstone"
        },
        "components": {
          "minecraft:map_color": {
              "color": "#408080"
          },
          "netease:redstone": {
            "type": "producer",
			"strength": 10
          }
        }
    }
}

自定义红石机械元件方块

自定义红石机械元件方块放置在地图上会接收红石信号,可以被激活。

对于自定义红石机械元件方块,其红石信号变化时触发事件 BlockStrengthChangedServerEvent

其中type为consumer初始红石信号量为0未激活状态不能通过netease:redstone的strength字段进行配置。

{
	"format_version": "1.10.0",
	"minecraft:block": {
		"description": {
			"identifier": "customblocks:customblocks_redstone_consumer"
		},
		"components": {
			"netease:redstone": {
                "type": "consumer"
			}
		}
	}
}