CraftLock
一个配方。一次机会。
一款 Fabric 模组,将每个合成变为仅有一次使用的机会。一旦你合成了它,在整局世界的生命周期内就再也无法再次合成该物品。
概述
CraftLock 是一款为内容创作者和自定挑战爱好者打造的硬核挑战模组。其设定简单而残酷:
游戏中的每种配方只能被合成为一次。之后,它将永远消失。
当你第一次合成橡木木板、木棍、熔炉、钻石镐或末影之眼时,该配方就会被锁定。下次你将相同的材料放入工作台时,结果槽位将为空。模组会播放拒绝音效,并在动作栏显示提示 "Already crafted Oak Planks once"(已合成过橡木木板),你的工具箱里就会少一件工具。
它覆盖了工作台、2x2 背包网格、熔炉、高炉、烟熏炉、营火、锻造台、切石机和酿造台。默认情况下有两个配方被豁免——烈焰粉和末影之眼——因为如果没有它们,你就无法通关游戏。
功能
锁定机制
- 全面覆盖 — 工作台、背包 2x2、熔炉家族、锻造、切石机、酿造台
- 配方级粒度 — 来自原木的
oak_planks 与来自去皮原木的 oak_planks 分别独立锁定
- 重启后持久化 — 锁定列表保存在世界存档中,可跨会话保留
- 豁免列表 — 你可以选择让某些配方无限次使用(默认:
blaze_powder、ender_eye)
直播优化体验
- 黄色聊天广播 — 每次首次合成时显示:Chompii has crafted: Iron Ingot(Chompii 合成了:铁锭)
- 铃声提示 — 当新配方被锁定时,所有玩家都会听到铃声
- 动作栏警告 + 村民“不行”音效 — 尝试被阻止的合成时触发
- 工具提示徽章 — 被锁定的物品显示红色斜体 Locked 行及归属信息:by Chompii · day 7
- 配方书叠加层 — 配方书中被锁定的配方会以红色色调高亮显示
- 动态标题 — 执行
/craftlock start 时播放(浅蓝色斜体 CraftLock 带副标题,伴随柔和紫水晶叮声)
工具支持
- 完整的命令套件供管理员/主播使用(见下文)
- JSON 配置文件位于
config/craftlock.json,用于调整音效、豁免列表和品牌文本
- 通过
assets/craftlock/lang/en_us.json 支持翻译
- 使用
craftlock 命名空间的 SLF4J 日志记录器
安装
要求
| 组件 |
版本 |
| Minecraft |
1.21.11 |
| Fabric Loader |
>= 0.19.2 |
| Fabric API |
0.141.4+1.21.11 |
| Java |
21 |
步骤
- 为 Minecraft
1.21.11 安装 Fabric Loader。
- 将 Fabric API 放入你的
mods/ 文件夹。
- 将最新的
craftlock-1.0.jar(来自 Releases 页面)与其放在同一目录下。
- 启动游戏。当你加载世界时模组会自动运行——但锁定功能不会立即生效,直到你执行
/craftlock start。
命令
所有命令都需要 gamemaster 权限等级(在原版游戏中对应等级 2——单人主机自动获得此权限)。
| 命令 |
描述 |
/craftlock start |
开始强制执行锁定。向所有玩家展示 CraftLock 标题。 |
/craftlock stop |
暂停执行但不清除锁定列表。使用 start 恢复。 |
/craftlock status |
打印运行状态、已锁定配方数量和已豁免配方数量。 |
/craftlock list |
按 ID 列出所有已锁定配方。 |
/craftlock reset |
清除整个锁定列表。不影响 started 标志。 |
/craftlock lock <recipe> |
手动锁定某个配方(适用于设置挑战场景)。 |
/craftlock unlock <recipe> |
手动解锁单个配方。 |
示例
> /craftlock start
[CraftLock started.]
[Title: CraftLock]
[Subtitle: Created by Chompii]
> /craftlock list
Locked recipes (3):
- minecraft:oak_planks
- minecraft:stick
- minecraft:crafting_table
> /craftlock unlock minecraft:stick
Unlocked minecraft:stick
配置
首次启动时,模组会生成 config/craftlock.json 文件,包含以下默认值。编辑该文件并重启世界以应用更改。
{
"titleText": "CraftLock",
"subtitleText": "Created by Chompii",
"exemptRecipes": [
"minecraft:blaze_powder",
"minecraft:ender_eye"
],
"craftPingVolume": 0.6,
"craftPingPitch": 1.5,
"startSoundVolume": 1.0,
"startSoundPitch": 1.0,
"blockedSoundVolume": 1.0,
"blockedSoundPitch": 1.0
}
| 字段 |
类型 |
说明 |
titleText |
string |
执行 /craftlock start 时显示的文本。 |
subtitleText |
string |
与标题配对的副标题。 |
exemptRecipes |
string[] |
可以无限次合成的配方 ID。 |
craftPingVolume / craftPingPitch |
float |
每次首次合成时播放的铃声音量/音调。 |
startSoundVolume / startSoundPitch |
float |
执行 /craftlock start 时播放的紫水晶叮声音量/音调。 |
blockedSoundVolume / blockedSoundPitch |
float |
合成被阻止时播放的村民“不行”音效音量/音调。 |
工作原理
CraftLock 基于每个世界的 SavedData 实例构建,存储以下内容:
- 一组已锁定的配方 ID
- 元数据映射:
{recipe_id -> {crafter, world_day}}
- 一个
started 标志
Mixin 附加到相应的原版菜单和方块实体上:
| 类 |
Hook |
目的 |
CraftingMenu |
slotChangedCraftingGrid (TAIL) |
如果匹配的配方被锁定,则清空结果槽位并发送 ClientboundContainerSetSlotPacket。同时缓存配方,以便在原版鼠标右键快速取走物品后,ResultSlot.onTake 仍能访问它。 |
ResultSlot |
onTake (HEAD) |
记录锁定状态 + 进行广播。 |
AbstractFurnaceBlockEntity |
canBurn (HEAD) + setRecipeUsed (HEAD) |
如果已锁定则阻止熔炼;完成后进行记录。 |
CampfireBlockEntity |
getCookableRecipe (RETURN) + placeFood (RETURN) |
如果已锁定则阻止放置食物;放置时进行记录。 |
SmithingMenu |
createResult (TAIL) + onTake (HEAD) |
如果已锁定则清空结果;取走时进行记录。 |
StonecutterMenu |
setupResultSlot (TAIL) + onTake (HEAD) |
采用相同的模式。 |
PotionBrewing |
mix (RETURN) |
如果输出将是被锁定的药水变种,则返回未混合的输入物;成功酿造时施加锁定。 |
RecipeButton |
renderWidget (TAIL) — 仅客户端 |
在配方书内为已锁定的配方绘制红色覆盖层。 |
当锁定列表发生变化时,通过自定义数据包 craftlock:lock_list 将状态同步给所有已连接客户端,因此工具提示和配方书覆盖层会实时更新。
挑战跑图者须知
典型的跑图流程:
- 创建新世界。 锁定列表按存档持久化,因此请勿复用旧存档。
- 运行
/craftlock start 以开始执行限制。在此之前,模组仅处于观察模式。
- 规划你的路线。 末影之眼和烈焰粉不受限制,因此你可以到达末地。除此之外——每一个合成配方——在首次制作时即被锁定。
- 如果你需要重录某一段落,请在拍摄间隔使用
/craftlock reset。
- 使用
/craftlock list 来审计你已消耗的物品。
给剪辑师的提示: 黄色的聊天广播(Chompii has crafted: ...)旨在即使在压缩的 YouTube 视频片段中也易于阅读,并且非常适合配合“里程碑时刻”剪辑时的铃声提示。
从源码构建
git clone <repository-url>
cd CraftLock
./gradlew build
编译后的 jar 文件位于 build/libs/ 中。
对于开发,你可以使用:
./gradlew runClient # 启动加载了模组的开发客户端
./gradlew runServer # 启动专用的开发服务器
./gradlew genSources # 反编译 Minecraft 以便 IDE 导航
致谢
由 Chompii 制作。
基于 Fabric 模组开发工具链构建。由 SpongePowered Mixin 和 MixinExtras 提供支持。
许可证
根据 CraftLock License 发布 —— 完整文本请参阅 LICENSE。
简而言之:
- 你可以使用、修改、分发、分叉、重新打包和嵌入该模组。
- 你必须在使用该模组时显式署名 Chompii(视频描述、整合包致谢、衍生模组自述文件等)。
- 你不得声称自己是 CraftLock 的原始作者。
- 软件按“原样”提供,不提供任何担保。
如果你正在发布视频,适当的署名格式如下:
"Featuring CraftLock by Chompii — github.com/Chompii/CraftLock"
CraftLock
One craft. One chance.
A Fabric mod that turns every recipe into a single-use opportunity. Once you make it, you can never make it again — for the entire lifetime of the world.
Overview
CraftLock is a hardcore-challenge mod built for content creators and self-imposed-challenge enjoyers. The premise is simple and brutal:
Every recipe in the game can only be crafted once. After that, it's gone forever.
The first time you craft oak planks, sticks, a furnace, a diamond pickaxe, an Eye of Ender — that recipe locks. The next time you put the same ingredients in a crafting table, the result slot stays empty. The mod plays a denial sound, shows you the actionbar message "Already crafted Oak Planks once", and the run continues with one fewer tool in your kit.
It covers crafting tables, the 2x2 inventory grid, furnaces, blast furnaces, smokers, campfires, smithing tables, stonecutters, and the brewing stand. Two recipes are exempt by default — Blaze Powder and Eye of Ender — because without them, you can't finish the game.
Features
Locking
- Universal coverage — crafting table, inventory 2x2, furnace family, smithing, stonecutter, brewing stand
- Recipe-level granularity —
oak_planks from logs locks separately from oak_planks from stripped logs
- Persistent across restarts — the lock list is stored in the world save and survives sessions
- Exempt list — recipes you choose stay infinite (default:
blaze_powder, ender_eye)
UX polish for streaming
- Yellow chat broadcast on every first-time craft: Chompii has crafted: Iron Ingot
- Bell ping plays for all players when a new recipe is locked
- Actionbar warning + villager-no sound when a blocked craft is attempted
- Tooltip badge — locked items display a red italic Locked line with attribution: by Chompii · day 7
- Recipe-book overlay — locked recipes are highlighted with a red tint inside the recipe book
- Animated title played on
/craftlock start (light-blue italic CraftLock with subtitle, plus a calm amethyst chime)
Tooling
- A full command suite for moderators / streamers (see below)
- JSON config at
config/craftlock.json for sound tuning, exempt list, and brand text
- Translation support via
assets/craftlock/lang/en_us.json
- SLF4J logger under the
craftlock namespace
Installation
Requirements
| Component |
Version |
| Minecraft |
1.21.11 |
| Fabric Loader |
>= 0.19.2 |
| Fabric API |
0.141.4+1.21.11 |
| Java |
21 |
Steps
- Install Fabric Loader for Minecraft
1.21.11.
- Drop Fabric API into your
mods/ folder.
- Drop the latest
craftlock-1.0.jar (from the Releases page) alongside it.
- Launch the game. The mod will run as soon as you load a world — locking does not start until you invoke
/craftlock start.
Commands
All commands require permission level gamemaster (level 2 in vanilla terms — automatically granted to the singleplayer host).
| Command |
Description |
/craftlock start |
Begin enforcing locks. Shows the CraftLock title to all players. |
/craftlock stop |
Pause enforcement without clearing the lock list. Resume with start. |
/craftlock status |
Print run state, locked-recipe count, and exempt-recipe count. |
/craftlock list |
List every locked recipe by ID. |
/craftlock reset |
Wipe the entire lock list. Does not affect the started flag. |
/craftlock lock <recipe> |
Manually lock a recipe (useful for setting up challenges). |
/craftlock unlock <recipe> |
Manually unlock a single recipe. |
Example
> /craftlock start
[CraftLock started.]
[Title: CraftLock]
[Subtitle: Created by Chompii]
> /craftlock list
Locked recipes (3):
- minecraft:oak_planks
- minecraft:stick
- minecraft:crafting_table
> /craftlock unlock minecraft:stick
Unlocked minecraft:stick
Configuration
On first launch the mod writes config/craftlock.json with the defaults below. Edit the file and restart the world to apply changes.
{
"titleText": "CraftLock",
"subtitleText": "Created by Chompii",
"exemptRecipes": [
"minecraft:blaze_powder",
"minecraft:ender_eye"
],
"craftPingVolume": 0.6,
"craftPingPitch": 1.5,
"startSoundVolume": 1.0,
"startSoundPitch": 1.0,
"blockedSoundVolume": 1.0,
"blockedSoundPitch": 1.0
}
| Field |
Type |
Notes |
titleText |
string |
Text shown when /craftlock start fires. |
subtitleText |
string |
Subtitle paired with the title. |
exemptRecipes |
string[] |
Recipe IDs that can be crafted any number of times. |
craftPingVolume / craftPingPitch |
float |
Bell sound played on every first-time craft. |
startSoundVolume / startSoundPitch |
float |
Amethyst chime played on /craftlock start. |
blockedSoundVolume / blockedSoundPitch |
float |
Villager "no" played when a craft is blocked. |
How it works
CraftLock is built around a per-world SavedData instance that stores:
- A set of locked recipe IDs
- A metadata map:
{recipe_id -> {crafter, world_day}}
- A
started flag
Mixins attach to the appropriate vanilla menus and block entities:
| Class |
Hook |
Purpose |
CraftingMenu |
slotChangedCraftingGrid (TAIL) |
Clear the result slot + send a ClientboundContainerSetSlotPacket if the matched recipe is locked. Also caches the recipe so ResultSlot.onTake can still see it after vanilla's shift-click drain. |
ResultSlot |
onTake (HEAD) |
Record the lock + broadcast. |
AbstractFurnaceBlockEntity |
canBurn (HEAD) + setRecipeUsed (HEAD) |
Block smelting if locked; record on completion. |
CampfireBlockEntity |
getCookableRecipe (RETURN) + placeFood (RETURN) |
Block placement if locked; record on placement. |
SmithingMenu |
createResult (TAIL) + onTake (HEAD) |
Clear result if locked; record on take. |
StonecutterMenu |
setupResultSlot (TAIL) + onTake (HEAD) |
Same pattern. |
PotionBrewing |
mix (RETURN) |
Return the unmixed input if the output would be a locked potion variant; lock on successful brew. |
RecipeButton |
renderWidget (TAIL) — client only |
Paint a red overlay on locked recipes inside the recipe book. |
State syncs to all connected clients via a craftlock:lock_list custom payload whenever the lock list changes, so tooltips and the recipe-book overlay update live.
For challenge runners
A typical run flow:
- Create a fresh world. The lock list persists per-save, so don't reuse old ones.
- Run
/craftlock start to begin enforcement. Until you do, the mod runs in observe-only mode.
- Plan your path. Eye of Ender and Blaze Powder are exempt, so the End is reachable. Everything else — every single recipe — locks on first craft.
- Use
/craftlock reset between filming takes if you need to redo a segment.
- Use
/craftlock list to audit what you've spent.
Tip for editors: the yellow chat broadcasts (Chompii has crafted: ...) are designed to be readable in compressed YouTube footage and pair well with the bell ping for "milestone moment" cuts.
Building from source
git clone <repository-url>
cd CraftLock
./gradlew build
The compiled jar lands in build/libs/.
For development you can use:
./gradlew runClient # launch a dev client with the mod loaded
./gradlew runServer # launch a dedicated dev server
./gradlew genSources # decompile Minecraft for IDE navigation
Credits
Made by Chompii.
Built on the Fabric modding toolchain. Powered by SpongePowered Mixin and MixinExtras.
License
Released under the CraftLock License — see LICENSE for the full text.
In short:
- You may use, modify, distribute, fork, repackage, and embed the mod.
- You must credit Chompii visibly in any use of the mod (video descriptions, modpack credits, derivative mod readmes, etc.).
- You may not claim to be the original author of CraftLock.
- The software is provided "as is" with no warranty.
If you're publishing a video, a fair-use credit looks like:
"Featuring CraftLock by Chompii — github.com/Chompii/CraftLock"
评论 0
登录后参与评分
还没有评论,来抢沙发吧