Cpack
一款适用于 Minecraft 1.21.11+ 的 Fabric 模组,允许你将 .cpack 和 .mcfunction 文件作为脚本化的命令序列运行——支持 wait、call 以及完整的 Tab 补全功能。
由 Westires 制作
Cpack 是什么?
Cpack 的使用方式与 .mcfunction 文件类似,但它是按世界存储的,并带有额外的参数(wait、call)。你只需编写纯文本的命令脚本,将其加载到世界中,然后通过 /cp run 运行它们。所有文件在 world load 时都会预先解析——运行时零开销。
文件位置
脚本存储在世界文件夹内,而非全局配置中:
saves/<WorldName>/cpack/<namespace>/<your_script>.cpack
saves/<WorldName>/cpack/<namespace>/subfolder/<your_script>.mcfunction
<namespace> 是你选择的任意文件夹名称(例如 myproject、demo)
- 支持任意深度的子文件夹
- 同时支持
.cpack 和 .mcfunction 扩展名
脚本格式
与 .mcfunction 完全相同——每行一条命令。以 # 开头的注释行会被忽略。
# This is a comment
say Hello!
particle minecraft:end_rod ~ ~ ~ 0.5 0.5 0.5 0.1 20 normal
wait 10 tick
say 10 ticks later!
wait 2 second
call myproject:effects/firework.cpack
额外参数
| 参数 |
示例 |
描述 |
wait <n> tick |
wait 5 tick |
在执行下一行之前等待 n 刻 |
wait <n> second |
wait 2 second |
在执行下一行之前等待 n 秒(n × 20 刻) |
call <namespace:path> |
call demo:intro.cpack |
内联运行另一个 cpack/mcfunction 文件 |
注意: wait 仅暂停当前脚本——服务器保持正常运行。多个脚本可以并行运行。
命令
除 /cp list 外,所有命令都需要操作员等级 2(gamemaster)。
| 命令 |
描述 |
/cp |
显示命令列表 |
/cp run <namespace:file> |
运行一个 cpack/mcfunction 文件 |
/cp stop <all|namespace:file> |
立即停止正在运行的脚本(或所有脚本) |
/cp list [page] |
列出所有已加载文件及其状态 |
/cp disable <namespace:file> |
禁用一个文件(防止其运行) |
/cp enable <namespace:file> |
重新启用被禁用的文件 |
/cp reload <all|namespace:file> |
从磁盘重新加载文件并重新解析它们 |
所有参数均支持 Tab 补全——已加载的文件名会自动出现。
在 /execute 中使用
/execute positioned ~ ~1 ~ run cp run demo:frames/frame_000.cpack
示例
文件: saves/MyWorld/cpack/demo/fireworks.cpack
# Launch 3 firework bursts with delays
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
wait 10 tick
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
wait 10 tick
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
say Fireworks done!
运行它:
/cp run demo:fireworks.cpack
性能
- 所有文件均在 world load 时使用 Brigadier 解析器进行预先解析——就像原版
.mcfunction 一样
- 在运行时,仅调用
dispatcher.execute()——无需重新解析
- 命令反馈(来自
particle 等命令的聊天消息)默认被抑制,与 mcfunction 行为一致
- 多个脚本以并行方式运行,无人为限制
要求
安装
- 安装 Fabric
- 下载适用于 1.21.11 的 Fabric API
- 将
cpack-1.0.0.jar 放入你的 .minecraft/mods/ 文件夹
- 启动游戏并打开一个世界
- 在
saves/<WorldName>/cpack/<namespace>/ 中创建脚本
许可证
MIT —— 你可以随意使用它。
Cpack
A Fabric mod for Minecraft 1.21.11+ that lets you run .cpack and .mcfunction files as scripted command sequences — with wait, call, and full tab-completion support.
Made by Westires
What is Cpack?
Cpack works just like .mcfunction files, but stored per-world and with extra arguments (wait, call). You write plain command scripts, load them into your world, and run them with /cp run. All files are pre-parsed on world load — zero overhead at runtime.
File Location
Scripts are stored inside your world folder, not the global config:
saves/<WorldName>/cpack/<namespace>/<your_script>.cpack
saves/<WorldName>/cpack/<namespace>/subfolder/<your_script>.mcfunction
<namespace> is any folder name you choose (e.g. myproject, demo)
- Subfolders are supported at any depth
- Both
.cpack and .mcfunction extensions are supported
Script Format
Identical to .mcfunction — one command per line. Comment lines starting with # are ignored.
# This is a comment
say Hello!
particle minecraft:end_rod ~ ~ ~ 0.5 0.5 0.5 0.1 20 normal
wait 10 tick
say 10 ticks later!
wait 2 second
call myproject:effects/firework.cpack
Extra Arguments
| Argument |
Example |
Description |
wait <n> tick |
wait 5 tick |
Waits n ticks before executing the next line |
wait <n> second |
wait 2 second |
Waits n seconds (n × 20 ticks) before the next line |
call <namespace:path> |
call demo:intro.cpack |
Runs another cpack/mcfunction file inline |
Note: wait suspends only the current script — the server keeps running normally. Multiple scripts can run in parallel.
Commands
All commands require operator level 2 (gamemaster) except /cp list.
| Command |
Description |
/cp |
Shows the command list |
/cp run <namespace:file> |
Runs a cpack/mcfunction file |
/cp stop <all|namespace:file> |
Stops a running script (or all scripts) immediately |
/cp list [page] |
Lists all loaded files with their status |
/cp disable <namespace:file> |
Disables a file (prevents it from running) |
/cp enable <namespace:file> |
Re-enables a disabled file |
/cp reload <all|namespace:file> |
Reloads files from disk and re-parses them |
All arguments support tab completion — loaded file names appear automatically.
Using inside /execute
/execute positioned ~ ~1 ~ run cp run demo:frames/frame_000.cpack
Example
File: saves/MyWorld/cpack/demo/fireworks.cpack
# Launch 3 firework bursts with delays
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
wait 10 tick
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
wait 10 tick
particle minecraft:firework_rocket ~ ~1 ~ 0.5 0.5 0.5 0.05 30 normal
say Fireworks done!
Run it:
/cp run demo:fireworks.cpack
Performance
- All files are pre-parsed on world load using Brigadier's parser — just like vanilla
.mcfunction
- At runtime, only
dispatcher.execute() is called — no re-parsing
- Command feedback (chat messages from commands like
particle) is suppressed by default, matching mcfunction behavior
- Multiple scripts run in parallel with no artificial limits
Requirements
Installation
- Install Fabric
- Download Fabric API for 1.21.11
- Drop
cpack-1.0.0.jar into your .minecraft/mods/ folder
- Launch the game and open a world
- Create scripts in
saves/<WorldName>/cpack/<namespace>/
License
MIT — do whatever you want with it.
评论 0
登录后参与评分
还没有评论,来抢沙发吧