CS Cases
一款面向 Minecraft 的 CS:GO 风格开箱模组。放置箱子,使用对应的钥匙,观看转盘旋转,并领取你的战利品。
功能特性
- 原汁原味的开箱流程 — 在决定之前预览箱子内容,观看带有经典开箱音效的转盘式揭晓动画,然后显式点击 Claim(领取)你的奖励,或按 ESC 将其丢弃在地面上。
- 五级稀有度抽取,带有加权概率和熟悉的 CS 颜色编码:军规级蓝色 → 受限紫色 → 保密粉色 → 隐秘红色 → 罕见金色。
- 完全数据驱动 — 每个箱子都是数据包中的一个 JSON 文件。无需重新编译、打包或分发客户端资源包,即可在服务器或单人世界中添加、编辑或更换箱子品牌。
- 真实的物品堆叠作为奖励 — 奖励条目可以是
/give 命令接受的任何内容。堆叠数量、附魔、自定义名称、描述文本、属性修改器、染色皮革、任何已注册的数据组件,统统支持。
- 错钥保护 — 钥匙通过数据组件绑定到特定箱子。对不匹配的箱子使用钥匙会在动作栏显示 "This key does not fit this case."(此钥匙无法打开此箱子),且钥匙不会被消耗。
- 支持多人游戏 — 服务器在玩家加入及执行
/reload 后,会将完整的箱子注册表推送给所有客户端,因此专用服务器玩家能零客户端配置地看到服务器加载的全部箱子。
- 热重载 —
/reload 会从磁盘重新解析所有箱子。有效更改立即生效。格式错误的文件会被跳过,并在服务器日志中给出清晰警告,而不会导致世界崩溃。
- 集成于 Mods 菜单的游戏内配置界面。
工作原理
- 从创造模式标签页获取一个 Case(箱子)和一个匹配的 Case Key(钥匙)— 标签页会自动列出每种已加载箱子的各一个实例。
- 放置箱子。右键点击箱子并使用匹配的钥匙以打开 预览屏幕,显示所有可能的奖励,并按稀有度分组。
- 点击 Open(开启)以消耗钥匙并开始揭晓动画。在动画期间按 ESC 可直接跳转到奖励屏幕。
- 在奖励屏幕上,点击 Claim(领取)以拿走物品,或按 ESC 让物品掉落至你脚边。
添加你自己的箱子
将 JSON 文件放入以下路径:
<datapack-root>/data/<your-namespace>/cases/<case-id>.json
最小化示例:
{
"display_name": "Weapon Case",
"tiers": [
{
"id": "mil_spec",
"weight": 79.92,
"color": "4b69ff",
"items": ["minecraft:wooden_sword", "minecraft:stone_sword"]
},
{
"id": "covert",
"weight": 0.64,
"color": "eb4b4b",
"items": [
{
"id": "minecraft:diamond_sword",
"components": {
"minecraft:enchantments": { "minecraft:sharpness": 5 },
"minecraft:custom_name": "{\"text\":\"Awakened Blade\",\"color\":\"gold\"}"
}
}
]
}
]
}
稀有度权重在抽取时进行归一化处理,因此任何正数均可使用 — 1 和 99 的效果等同于 1% / 99%。物品可以是裸 ID(数量为 1,无组件),也可以是完整的 { "id": ..., "count": ..., "components": { ... } } 对象。
通过创造模式标签页或以下命令分发你的自定义箱子:
/give @s cs_cases:case_block[cs_cases:case_id="myserver:weapon_case"]
/give @s cs_cases:case_key[cs_cases:case_id="myserver:weapon_case"]
完整的 datapack 格式参考文档,包括所有支持的字段和验证规则,位于源码仓库中的 docs/datapack-cases.md。
内置内容
本模组附带一个默认箱子 — Starter Case(新手箱子)— 它与其它所有内容一样使用相同的 datapack 机制构建,因此其 JSON 同时也作为一个可运行的示例。
依赖要求
- Minecraft 26.1.2
- NeoForge 26.1.2.30-beta 或更高版本
仅支持 NeoForge。不兼容 Forge 或 Fabric。
同时支持单人游戏和多人游戏(专用服务器)。自定义箱子由服务器权威控制 — 在服务器和所有连接的客户端上安装该模组,并通过服务器上的数据包定义你的箱子。
许可证
保留所有权利。
CS Cases
A CS:GO-style case opening mod for Minecraft. Place a case, use the matching key, watch the reel spin, and claim your loot.
Features
- Authentic opening flow — preview a case's contents before you commit, watch a reel-style reveal animation with the classic case-unlock sound, then explicitly Claim your reward or press ESC to drop it on the ground.
- Five-tier rarity rolls with weighted probabilities and the familiar CS color coding: Mil-Spec blue → Restricted purple → Classified pink → Covert red → Rare Special gold.
- Fully data-driven — every case is a JSON file in a datapack. Add, edit, or rebrand cases on a server or in a single world without recompiling, repackaging, or shipping a client-side resource pack.
- Real item stacks as rewards — a reward entry is anything
/give accepts. Stack sizes, enchantments, custom names, lore, attribute modifiers, dyed leather, any registered data component, all of it.
- Wrong-key protection — keys are bound to specific cases via a data component. Using a key on a case it doesn't fit shows "This key does not fit this case." in the action bar; the key is not consumed.
- Multiplayer-ready — the server pushes its full case registry to every client on join and after
/reload, so dedicated-server players see exactly what the server has loaded with zero client-side setup.
- Hot reload —
/reload re-parses every case from disk. Valid changes apply immediately. Malformed files are skipped with a clear warning in the server log instead of crashing the world.
- In-game config screen integrated with the Mods menu.
How it works
- Grab a Case and a matching Case Key from the creative tab — the tab automatically lists one of each per loaded case.
- Place the case. Right-click it with the matching key to open the preview screen showing all possible rewards, grouped by tier.
- Hit Open to consume the key and start the reveal animation. Press ESC during the animation to skip straight to the reward screen.
- On the reward screen, click Claim to take the item, or press ESC to let it drop at your feet.
Adding your own cases
Drop a JSON file at:
<datapack-root>/data/<your-namespace>/cases/<case-id>.json
Minimal example:
{
"display_name": "Weapon Case",
"tiers": [
{
"id": "mil_spec",
"weight": 79.92,
"color": "4b69ff",
"items": ["minecraft:wooden_sword", "minecraft:stone_sword"]
},
{
"id": "covert",
"weight": 0.64,
"color": "eb4b4b",
"items": [
{
"id": "minecraft:diamond_sword",
"components": {
"minecraft:enchantments": { "minecraft:sharpness": 5 },
"minecraft:custom_name": "{\"text\":\"Awakened Blade\",\"color\":\"gold\"}"
}
}
]
}
]
}
Tier weights are normalised at roll time, so any positive numbers work — 1 and 99 is the same as 1% / 99%. Items can be either a bare id (count 1, no components) or a full { "id": ..., "count": ..., "components": { ... } } object.
Hand out your custom cases via the creative tab or:
/give @s cs_cases:case_block[cs_cases:case_id="myserver:weapon_case"]
/give @s cs_cases:case_key[cs_cases:case_id="myserver:weapon_case"]
The full datapack format reference, including every supported field and validation rule, lives at docs/datapack-cases.md in the source repository.
Built-in content
The mod ships one default case — the Starter Case — built with the same datapack machinery as everything else, so its JSON doubles as a working example.
Requirements
- Minecraft 26.1.2
- NeoForge 26.1.2.30-beta or newer
NeoForge only. Not compatible with Forge or Fabric.
Both single-player and multiplayer (dedicated server) are supported. Custom cases are server-authoritative — install the mod on the server and on every connecting client, and define your cases via datapacks on the server.
License
All Rights Reserved.
评论 0
登录后参与评分
还没有评论,来抢沙发吧