ComputerCraft Wake Nodes
ComputerCraft Wake Nodes 是一款适用于 Minecraft 1.20.1 的 Forge 模组,为 CC: Tweaked (ComputerCraft) 计算机添加了一个小型区块加载网络,特别适用于自动化设置。
它引入了三种 ComputerCraft 外围设备:
wake_node:连接到 ComputerCraft 计算机并以字符串 ID 注册,实质上充当区块加载器。
wake_node_advanced:wake_node 的升级版,允许用户选择加载区域(1×1、3×3 或 5×5 个区块)。
wake_controller:供其他计算机用于列出、加载、卸载和检查已注册的节点。
主要用途是唤醒远处的计算机设置,使其区块加载并运行 tick,从而让启动逻辑得以执行。
它还添加了 Wake Chip,一种由其他方块使用的合成组件。
如果安装了 Create,则提供 Wake Chip、Wake Node、Advanced Wake Node 和 Wake Controller 的自定义 Create 合成配方。
功能
- 通过将 Wake Node 附加到 ComputerCraft 计算机上来注册远程唤醒点。
- 从 Wake Controller 按需加载远程计算机所在的区块。
- 永久加载区块直到手动卸载,或使用自动超时临时加载。
- 跨服务器重启持久化节点注册信息。
- 保持区块加载的瞬态性:重启后不会自动恢复已加载的区块。
- 为两种方块提供简单的 ComputerCraft API。
要求
- Minecraft 1.20.1
- Forge 47.2.0+
- Java 17
- CC: Tweaked 1.108.4+
新增内容
Wake Chip
由其他方块使用的合成组件。
配方:

创造模式标签页:Ingredients
Wake Node
一个薄型外围设备方块,必须直接放置在 CC: Tweaked 计算机方块的旁边。
功能:
- 暴露
wake_node 外围设备类型
- 存储从 Lua 分配的节点 ID
- 将所连接计算机的维度与区块注册到持久化注册表中
- 如果支撑它的计算机被移除,会自动销毁
重要放置规则:
- 除非支撑方块是 ComputerCraft 计算机方块,否则拒绝放置
配方:

创造模式标签页:Functional Blocks
Advanced Wake Node
升级版的 Wake Node,允许用户选择围绕所连接计算机的加载区域:
- 1×1 — 1 个区块(与基础 Wake Node 相同)
- 3×3 — 9 个区块
- 5×5 — 25 个区块
它继承了基础 Wake Node 的所有功能,并增加了 setRange()、getRange() 和 listAvailableRanges() 方法。
配方(形状与 Wake Node 相同,但使用下界合金而非铁):

创造模式标签页:Functional Blocks
Wake Controller
供控制器计算机管理已注册唤醒点的外围设备方块。
功能:
- 暴露
wake_controller 外围设备类型
- 列出已注册的节点
- 加载和卸载节点区块
- 报告节点当前是否处于加载状态以及临时加载剩余的时间
配方:

创造模式标签页:Functional Blocks
工作原理
- 在 CC: Tweaked 计算机的面上放置一个 Wake Node。
- 在该计算机上,对
wake_node 外围设备调用 setId("some_name") 以注册该节点。
执行此注册的计算机将成为该节点的所有者。
- 使用
grantController(computerId) 授权控制器计算机。
- 在另一台计算机旁放置一个 Wake Controller。
- 从已授权的控制器计算机上,调用
loadNode("some_name") 或 loadFor("some_name", seconds)。
被加载的区块是计算机所在的区块,而不是 Wake Node 方块所在的区块。
每个节点都有一个所有者计算机和一个授权控制器计算机 ID 的访问控制列表 (ACL)。
控制器方法仅对调用计算机有权管理的节点进行操作。
节点注册信息会被保存,但强制加载的活跃区块不会保留。服务器重启后,节点仍存在于注册表中,但在再次请求之前,它们都不会保持加载状态。
ComputerCraft API
外围设备类型
- Wake Node 外围设备类型:
wake_node
- Advanced Wake Node 外围设备类型:
wake_node_advanced
- Wake Controller 外围设备类型:
wake_controller
Wake Node API
使用标准的 ComputerCraft 调用查找外围设备,例如:
local wake = peripheral.find("wake_node")
有关更紧凑的 API 文档版本,请参阅 GitHub 上的 API.md 文件。
setId(id)
在给定的字符串 ID 下注册此 Wake Node。
id 必须是非空字符串
- 首次成功注册时,调用计算机将成为节点所有者
- 如果同一节点上已注册相同的 ID,则接受调用
- 如果该 ID 已被另一个节点使用,则调用会引发错误
示例:
local wake = peripheral.find("wake_node")
assert(wake, "wake_node not found")
wake.setId("remote_factory")
grantController(computerId)
授权控制器计算机 ID 管理此节点。
- 只有所有者计算机可以调用此方法
computerId 必须是正整数
- 幂等:重复授予相同的 ID 会被接受
revokeController(computerId)
从此节点的允许列表中移除控制器计算机 ID。
- 只有所有者计算机可以调用此方法
- 幂等:撤销不存在的 ID 会被接受
listControllers()
返回排序后的授权控制器计算机 ID 列表。
getPermissions()
返回此节点的所有权和控制器 ACL:
{
owner = 17,
controllers = { 42, 73 }
}
getId()
返回当前节点 ID,如果尚未分配则返回 nil。
示例:
print(wake.getId())
getChunk()
返回一个描述附加计算机所在区块的表格:
{
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4
}
getInfo()
返回包含节点 ID 和区块信息的表格:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4
}
如果尚未分配 ID,则 id 字段将返回空字符串。
Advanced Wake Node API
Advanced Wake Node 暴露了 wake_node_advanced 外设类型。它继承了基础 Wake Node 的所有方法,并增加了以下内容:
local wake = peripheral.find("wake_node_advanced")
setRange(size)
设置计算机周围的加载区域大小。
size 必须为 1、3 或 5
- 只有节点所有者可以调用此方法
- 如果节点当前处于加载状态,设置的区块会实时更新(除非在配置中禁用)
- 如果范围超过服务器最大值或调用者不是所有者,则抛出错误
示例:
wake.setRange(5) -- 加载 5×5 的区域(25 个区块)
getRange()
返回当前的范围大小(1、3 或 5)。
print(wake.getRange()) -- 3
listAvailableRanges()
根据服务器配置返回允许的范围值数组。
local ranges = wake.listAvailableRanges()
-- { 1, 3, 5 }
getInfo() (重写)
返回与基础 getInfo() 相同的表格,并额外增加两个字段:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4,
range = 3,
loaded_chunks = 9
}
Wake Controller API
使用标准的 ComputerCraft 调用查找外设,例如:
local ctl = peripheral.find("wake_controller")
listNodes()
返回调用控制器计算机可访问的已注册节点 ID 列表。
示例:
for _, id in ipairs(ctl.listNodes()) do
print(id)
end
getNodeInfo(id)
返回可访问节点的节点信息。
如果节点不存在或调用控制器未获授权,则抛出错误。
返回的表格:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4,
loaded = false,
expires_at = 90
}
注意:
loaded 是布尔值
expires_at 仅存在于临时加载的情况
expires_at 报告的是剩余秒数,而非绝对时间戳
loadNode(id)
无限期强制加载该节点的区块,直到发生以下情况之一:
- 调用了
unloadNode(id)
- 调用了
unloadAll()
- 服务器停止
如果节点不存在,则抛出错误。
如果调用控制器未获得该节点的授权,也会抛出错误。
loadFor(id, seconds)
强制加载该节点的区块一段时间。
seconds 必须为正数
seconds 不得超过配置的 max_load_duration_seconds
如果节点不存在或持续时间无效,则抛出错误。
如果调用控制器未获得该节点的授权,也会抛出错误。
unloadNode(id)
如果给定节点当前处于加载状态,则将其卸载。
unloadAll()
卸载调用控制器可访问的所有当前加载的节点。
isNodeLoaded(id)
如果节点当前处于加载状态则返回 true,否则返回 false。
如果调用控制器未获得该节点的授权,则抛出错误。
getLoadedNodes()
返回调用控制器可访问的当前加载的节点 ID 列表。
示例设置
Remote Computer
将 Wake Node 附加到计算机并注册它:
local wake = peripheral.find("wake_node")
assert(wake, "wake_node not found")
wake.setId("remote_factory")
wake.grantController(42) -- controller computer ID
print(textutils.serialize(wake.getInfo()))
Controller Computer
远程加载区块两分钟:
local ctl = peripheral.find("wake_controller")
assert(ctl, "wake_controller not found")
print("Known nodes:")
for _, id in ipairs(ctl.listNodes()) do
print(" - " .. id)
end
ctl.loadFor("remote_factory", 120)
print(textutils.serialize(ctl.getNodeInfo("remote_factory")))
配置
服务器配置键:
chunk_loading.max_loaded_nodes: 同时加载的最大节点数。默认值:16
chunk_loading.max_load_duration_seconds: loadFor 接受的最大持续时间。默认值:300
chunk_loading.default_load_radius: 目标计算机周围的区块半径。0 表示仅加载计算机所在的区块。默认值:0
chunk_loading.chunk_ops_per_tick: 每个服务器刻处理的最大排队加载/卸载操作数。较低的值可以平滑峰值,但 Wake Node 的响应速度会变慢。默认值:3
通用配置键:
logging.enable_node_logs: 启用注册、加载、卸载和过期事件的服务器日志消息。默认值:true
行为说明
- 注册通过世界级注册表共享。
- 每个节点都有一个所有者计算机 ID 和一个授权控制器计算机 ID 的 ACL。
- 控制器方法仅对调用控制器被授权管理的节点进行操作。
- 如果 Wake Node 被破坏,其注册将被移除。
- 如果支撑计算机被移除,Wake Node 会自动损坏。
- 临时区块加载会在服务器刻到期并自动清理。
- 服务器停止时,所有活动的区块票证都会释放。
示例脚本
仓库中包含 sampleScripts/recallCreateTrains/ 中的示例 Lua 脚本,演示了如何使用 Wake Node 唤醒远程 Create 站计算机并通过 Rednet 协调列车召回流程。
许可证
代码采用 MIT 许可证授权。
部分捆绑资产(纹理)根据 ComputerCraft 公共许可证 v1.0.0 (CCPL) 获得许可。
有关详细信息,请参阅 GitHub 上的 LICENSE 和 LICENSE-CCPL 文件。
ComputerCraft Wake Nodes
ComputerCraft Wake Nodes is a Forge mod for Minecraft 1.20.1 that adds a small chunk-loading network for CC: Tweaked (ComputerCraft) computers, particularly useful for automation setups.
It introduces three ComputerCraft peripherals:
wake_node: attached to a ComputerCraft computer and registered under a string ID, effectively serving as the chunk loader.
wake_node_advanced: an upgraded version of wake_node that lets the user choose the loaded area (1×1, 3×3, or 5×5 chunks).
wake_controller: used by another computer to list, load, unload, and inspect registered nodes.
The main use case is waking distant computer setups long enough for their chunk to load and tick, allowing their startup logic to run.
It also adds the Wake Chip, a crafting component used by the other blocks.
If Create is installed, custom Create recipes are provided for the Wake Chip, Wake Node, Advanced Wake Node, and Wake Controller.
Features
- Register remote wake points by attaching a Wake Node to a ComputerCraft computer.
- Load the remote computer's chunk on demand from a Wake Controller.
- Load chunks permanently until manual unload, or temporarily with an automatic timeout.
- Persist node registrations across server restarts.
- Keep chunk loading transient: loaded chunks are not restored automatically after a restart.
- Expose a simple ComputerCraft API for both blocks.
Requirements
- Minecraft 1.20.1
- Forge 47.2.0+
- Java 17
- CC: Tweaked 1.108.4+
Added Content
Wake Chip
Crafting component used by the other blocks.
Recipe:

Creative tab: Ingredients
Wake Node
A thin peripheral block that must be placed directly against a CC: Tweaked computer block.
What it does:
- exposes the
wake_node peripheral type
- stores a node ID assigned from Lua
- registers the attached computer's dimension and chunk in a persistent registry
- breaks automatically if its supporting computer is removed
Important placement rule:
- placement is refused unless the support block is a ComputerCraft computer block
Recipe:

Creative tab: Functional Blocks
Advanced Wake Node
An upgraded Wake Node that lets the user choose the loaded area around the attached computer:
- 1×1 — 1 chunk (same as a basic Wake Node)
- 3×3 — 9 chunks
- 5×5 — 25 chunks
It inherits all features of the basic Wake Node and adds setRange(), getRange(), and listAvailableRanges() methods.
Recipe (same shape as Wake Node, but with netherite instead of iron):

Creative tab: Functional Blocks
Wake Controller
A peripheral block used by a controller computer to manage registered wake nodes.
What it does:
- exposes the
wake_controller peripheral type
- lists registered nodes
- loads and unloads node chunks
- reports whether nodes are currently loaded and how long temporary loads have left
Recipe:

Creative tab: Functional Blocks
How It Works
- Place a Wake Node on the face of a CC: Tweaked computer.
- On that computer, call
setId("some_name") on the wake_node peripheral to register the node.
The computer that performs this registration becomes the node owner.
- Authorize controller computers with
grantController(computerId).
- Place a Wake Controller next to another computer.
- From the authorized controller computer, call
loadNode("some_name") or loadFor("some_name", seconds).
The loaded chunk is the computer's chunk, not the Wake Node block's chunk.
Each node has an owner computer and an access control list (ACL) of authorized controller computer IDs.
Controller methods only operate on nodes the calling computer is authorized to manage.
Node registrations are saved, but active forced chunks are not. After a server restart, nodes still exist in the registry, but none of them remain loaded until requested again.
ComputerCraft API
Peripheral Types
- Wake Node peripheral type:
wake_node
- Advanced Wake Node peripheral type:
wake_node_advanced
- Wake Controller peripheral type:
wake_controller
Wake Node API
Find the peripheral with standard ComputerCraft calls such as:
local wake = peripheral.find("wake_node")
Check the API.md file on GitHub for a more compact version of the API documentation.
setId(id)
Registers this Wake Node under the given string ID.
id must be a non-empty string
- on first successful registration, the calling computer becomes the node owner
- if the same ID is already registered on the same node, the call is accepted
- if the ID is already used by another node, the call raises an error
Example:
local wake = peripheral.find("wake_node")
assert(wake, "wake_node not found")
wake.setId("remote_factory")
grantController(computerId)
Authorizes a controller computer ID to manage this node.
- only the owner computer can call this method
computerId must be a positive integer
- idempotent: granting the same ID twice is accepted
revokeController(computerId)
Removes a controller computer ID from this node's allowed list.
- only the owner computer can call this method
- idempotent: revoking an ID that is not present is accepted
listControllers()
Returns a sorted list of authorized controller computer IDs.
getPermissions()
Returns ownership and controller ACL for this node:
{
owner = 17,
controllers = { 42, 73 }
}
getId()
Returns the current node ID, or nil if none has been assigned.
Example:
print(wake.getId())
getChunk()
Returns a table describing the attached computer's chunk:
{
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4
}
getInfo()
Returns a table with the node ID and chunk information:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4
}
If no ID has been assigned yet, id is returned as an empty string.
Advanced Wake Node API
The Advanced Wake Node exposes the wake_node_advanced peripheral type. It inherits all methods from the basic Wake Node and adds the following:
local wake = peripheral.find("wake_node_advanced")
setRange(size)
Sets the loaded area around the computer.
size must be 1, 3, or 5
- only the node owner can call this method
- if the node is currently loaded, the chunk set is updated live (unless disabled by config)
- raises an error if the range exceeds the server max or the caller is not the owner
Example:
wake.setRange(5) -- load a 5×5 area (25 chunks)
getRange()
Returns the current range size (1, 3, or 5).
print(wake.getRange()) -- 3
listAvailableRanges()
Returns an array of allowed range values based on server configuration.
local ranges = wake.listAvailableRanges()
-- { 1, 3, 5 }
getInfo() (overridden)
Returns the same table as the basic getInfo() plus two extra fields:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4,
range = 3,
loaded_chunks = 9
}
Wake Controller API
Find the peripheral with standard ComputerCraft calls such as:
local ctl = peripheral.find("wake_controller")
listNodes()
Returns a list of registered node IDs accessible by the calling controller computer.
Example:
for _, id in ipairs(ctl.listNodes()) do
print(id)
end
getNodeInfo(id)
Returns node information for an accessible node.
Raises an error if the node does not exist or if the calling controller is not authorized.
Returned table:
{
id = "remote_factory",
dimension = "minecraft:overworld",
chunk_x = 12,
chunk_z = -4,
loaded = false,
expires_at = 90
}
Notes:
loaded is a boolean
expires_at is only present for temporary loads
expires_at is reported as remaining seconds, not an absolute timestamp
loadNode(id)
Force-loads the node's chunk indefinitely, until one of these happens:
unloadNode(id) is called
unloadAll() is called
- the server stops
Raises an error if the node does not exist.
Also raises an error if the calling controller is not authorized for this node.
loadFor(id, seconds)
Force-loads the node's chunk for a limited number of seconds.
seconds must be positive
seconds must not exceed the configured max_load_duration_seconds
Raises an error if the node does not exist or the duration is invalid.
Also raises an error if the calling controller is not authorized for this node.
unloadNode(id)
Unloads the given node if it is currently loaded.
unloadAll()
Unloads every currently loaded node accessible by the calling controller.
isNodeLoaded(id)
Returns true if the node is currently loaded, otherwise false.
Raises an error if the calling controller is not authorized for this node.
getLoadedNodes()
Returns a list of currently loaded node IDs accessible by the calling controller.
Example Setup
Remote Computer
Attach a Wake Node to a computer and register it:
local wake = peripheral.find("wake_node")
assert(wake, "wake_node not found")
wake.setId("remote_factory")
wake.grantController(42) -- controller computer ID
print(textutils.serialize(wake.getInfo()))
Controller Computer
Load the remote chunk for two minutes:
local ctl = peripheral.find("wake_controller")
assert(ctl, "wake_controller not found")
print("Known nodes:")
for _, id in ipairs(ctl.listNodes()) do
print(" - " .. id)
end
ctl.loadFor("remote_factory", 120)
print(textutils.serialize(ctl.getNodeInfo("remote_factory")))
Configuration
Server config keys:
chunk_loading.max_loaded_nodes: maximum number of nodes that may be loaded at the same time. Default: 16
chunk_loading.max_load_duration_seconds: maximum duration accepted by loadFor. Default: 300
chunk_loading.default_load_radius: chunk radius around the target computer. 0 means only the computer's own chunk. Default: 0
chunk_loading.chunk_ops_per_tick: maximum number of queued load/unload operations processed each server tick. Lower values smooth spikes but wake nodes more slowly. Default: 3
Common config keys:
logging.enable_node_logs: enables server log messages for register, load, unload, and expiration events. Default: true
Behavior Notes
- Registrations are shared through a world-level registry.
- Each node has an owner computer ID and an ACL of authorized controller computer IDs.
- Controller methods only operate on nodes the calling controller is authorized to manage.
- If a Wake Node is broken, its registration is removed.
- If the supporting computer is removed, the Wake Node breaks automatically.
- Temporary chunk loads expire on server tick and are cleaned up automatically.
- On server stop, all active chunk tickets are released.
Sample Scripts
The repository includes example Lua scripts in sampleScripts/recallCreateTrains/ demonstrating how Wake Nodes can wake remote Create station computers and coordinate train recall flows over Rednet.
License
Code is licensed under the MIT License.
Some bundled assets (textures) are licensed under the ComputerCraft Public License v1.0.0 (CCPL).
See the LICENSE and LICENSE-CCPL files on GitHub for details.
评论 0
登录后参与评分
还没有评论,来抢沙发吧