CC Redstone Link Bridge
适用于 Minecraft 1.21.1 的 NeoForge 模组。
注意: 本描述仅针对该模组的 最新版本。
旧版本可能功能较少或行为不同。
此模组将 Create Redstone Link 网络 与 CC:Tweaked 计算机 连接起来。
它添加了一个方块,即 CC Redstone Link Bridge,可以放置在世界中并作为 ComputerCraft 的外设使用。
此模组需要同时安装 Create 和 CC:Tweaked。
模组功能
该桥接器充当两个系统之间的小型适配器:
- Create 提供 Redstone Link 网络。
- CC:Tweaked 提供来自计算机的 Lua 控制。
当世界中存在桥接器方块时,连接的计算机可以:
- 读取任意 Redstone Link 频率对的当前信号强度
- 向任意 Redstone Link 频率对发送信号强度
- 列出桥接器当前正在发送的所有频率对
- 一次性停止桥接器发送的所有信号
工作原理
该方块本身是一个兼容 Create 的可链接区块实体。
它将一个或多个目标频率对存储为物品 ID,并与 Create Redstone Link 网络进行交互。
当从 Lua 中使用该外设时:
getLinkSignal(freq1, freq2) 查找该频率对的当前强度。
sendLinkSignal(freq1, freq2, strength) 在桥接器方块上注册或更新该频率对,并传输所选强度。
getActive() 返回桥接器当前正在传输的所有频率对(强度大于 0)。
clearAll() 移除桥接器上的所有频率对,使其完全停止传输。
通过传入不同的频率对调用 sendLinkSignal,可以使单个桥接器方块同时保持多个输出活跃。
频率值是作为字符串编写的物品 ID。
例如,minecraft:iron_ingot 和 minecraft:oak_sapling 构成一个有效的对。
要求
- Minecraft
1.21.1
- NeoForge
21.1.226 或更高版本
- Create
6.0.10 或适用于 1.21.1 的兼容版本
- CC:Tweaked
1.117.1 或兼容版本
- Java
21
合成配方
配方为 3x3 形状合成,四个角放置 Redstone Links,中心放置无线调制解调器(Wireless Modem),底部中间槽位放置圆石。其余三个中间边缘槽位(顶部中间、左侧中间和右侧中间)填充 Create 发射器。
Lua API
外设类型:
方法:
| 方法 |
返回值 |
描述 |
getLinkSignal(freq1, freq2) |
number |
频率对的当前信号强度(0-15)。 |
sendLinkSignal(freq1, freq2, strength) |
- |
在频率对上传输 strength(限制在 0-15 范围内)。 |
getActive() |
table |
桥接器正在传输且强度 > 0 的所有对的列表。每个条目格式为 { freq1 = "minecraft:diamond", freq2 = "minecraft:redstone", strength = 7 }。强度设置为 0 的对不会包含在内。如果没有传输任何内容,则返回 {}。 |
clearAll() |
- |
从桥接器中移除所有对并停止其所有信号。仅由该桥接器供电的接收者将降至 0。之后 getActive() 返回 {}。 |
频率值
freq1 和 freq2 必须是作为字符串的物品 ID。
示例:
"minecraft:iron_ingot"
"minecraft:oak_sapling"
"minecraft:redstone"
对于空的频率槽,请使用空字符串("")。这与 Create Redstone Links 频率槽中没有物品的情况相匹配。
它适用于 getLinkSignal 和 sendLinkSignal,并且在世界保存和重新加载时保持不变。
例如,bridge.sendLinkSignal("", "", 15) 可以为尚未设置频率物品的全新 Redstone Links 供电。
不存在的物品 ID(例如拼写错误如 "minecraft:diamnod")会引发 Lua 错误。它不会被视作空频率。
示例
local bridge = peripheral.find("redstone_link_bridge")
assert(bridge, "No redstone_link_bridge found")
-- 读取现有的频率对
local current = bridge.getLinkSignal("minecraft:diamond", "minecraft:redstone")
print("Current signal:", current)
-- 在同一桥接器方块上注册或更新一个或多个输出通道
bridge.sendLinkSignal("minecraft:diamond", "minecraft:redstone", 7)
bridge.sendLinkSignal("minecraft:iron_ingot", "minecraft:oak_sapling", 12)
bridge.sendLinkSignal("", "", 15) -- 空频率槽
-- 列出桥接器当前正在传输的所有内容
for _, channel in ipairs(bridge.getActive()) do
print(channel.freq1, channel.freq2, channel.strength)
end
-- 停止此桥接器的所有信号
bridge.clearAll()
CC Redstone Link Bridge
NeoForge mod for Minecraft 1.21.1.
Note: This description always refers to the latest version of the mod only.
Older versions may have fewer functions or behave differently.
This mod connects Create Redstone Link networks with CC:Tweaked computers.
It adds a single block, the CC Redstone Link Bridge, which can be placed in the world and then used as a ComputerCraft peripheral.
This mod requires both Create and CC:Tweaked.
What the Mod Does
The bridge acts as a small adapter between two systems:
- Create provides the Redstone Link network.
- CC:Tweaked provides Lua control from computers.
With the bridge block in the world, a connected computer can:
- read the current signal strength of any Redstone Link frequency pair
- send a signal strength to any Redstone Link frequency pair
- list all frequency pairs the bridge is currently sending on
- stop all signals sent by the bridge at once
How It Works
The block itself is a Create-compatible linkable block entity.
It stores one or more target frequency pairs as item IDs and can interact with the Create Redstone Link network.
When the peripheral is used from Lua:
getLinkSignal(freq1, freq2) looks up the current strength for that frequency pair.
sendLinkSignal(freq1, freq2, strength) registers or updates that frequency pair on the bridge block and transmits the chosen strength.
getActive() returns every frequency pair the bridge is currently transmitting on (strength greater than 0).
clearAll() removes all frequency pairs from the bridge, so it stops transmitting completely.
Calling sendLinkSignal with different frequency pairs lets one bridge block keep multiple outputs active at the same time.
The frequency values are item IDs written as strings.
For example, minecraft:iron_ingot and minecraft:oak_sapling form one valid pair.
Requirements
- Minecraft
1.21.1
- NeoForge
21.1.226 or newer
- Create
6.0.10 or compatible for 1.21.1
- CC:Tweaked
1.117.1 or compatible
- Java
21
Crafting Recipe
The recipe is a 3x3 shaped craft with Redstone Links in all four corners, a Wireless Modem in the center, and Cobblestone in the bottom-middle slot. The three remaining middle-edge slots (top-middle, middle-left, and middle-right) are filled with Create transmitters.
Lua API
Peripheral type:
Methods:
| Method |
Returns |
Description |
getLinkSignal(freq1, freq2) |
number |
Current signal strength (0-15) of the frequency pair. |
sendLinkSignal(freq1, freq2, strength) |
- |
Transmits strength (clamped to 0-15) on the frequency pair. |
getActive() |
table |
List of all pairs the bridge is transmitting on with strength > 0. Each entry looks like { freq1 = "minecraft:diamond", freq2 = "minecraft:redstone", strength = 7 }. Pairs set to strength 0 are not included. Returns {} if nothing is being transmitted. |
clearAll() |
- |
Removes all pairs from the bridge and stops all of its signals. Receivers that were only powered by this bridge drop to 0. Afterwards getActive() returns {}. |
Frequency Values
freq1 and freq2 must be item IDs as strings.
Examples:
"minecraft:iron_ingot"
"minecraft:oak_sapling"
"minecraft:redstone"
Use an empty string ("") for an empty frequency slot. This matches Create Redstone Links whose frequency slot has no item in it.
It works for both getLinkSignal and sendLinkSignal, and it is kept when the world is saved and loaded again.
For example, bridge.sendLinkSignal("", "", 15) powers fresh Redstone Links that have no frequency items set.
An item ID that does not exist (for example a typo like "minecraft:diamnod") raises a Lua error. It is not treated as an empty frequency.
Example
local bridge = peripheral.find("redstone_link_bridge")
assert(bridge, "No redstone_link_bridge found")
-- Read an existing frequency pair
local current = bridge.getLinkSignal("minecraft:diamond", "minecraft:redstone")
print("Current signal:", current)
-- Register or update one or more output channels on the same bridge block
bridge.sendLinkSignal("minecraft:diamond", "minecraft:redstone", 7)
bridge.sendLinkSignal("minecraft:iron_ingot", "minecraft:oak_sapling", 12)
bridge.sendLinkSignal("", "", 15) -- empty frequency slots
-- List everything the bridge is currently transmitting
for _, channel in ipairs(bridge.getActive()) do
print(channel.freq1, channel.freq2, channel.strength)
end
-- Stop all signals from this bridge
bridge.clearAll()
评论 0
登录后参与评分
还没有评论,来抢沙发吧