ChestLootControl - Chest Loot Control
? 简介
ChestLootControl 是一款轻量级的 Fabric 管理工具模组,通过简单的命令让你完全掌控世界中所有箱子内的物品。可以一次性清空所有容器,或使用完全可自定义的物品随机填充它们——包括完整的 NBT 支持。非常适合地图制作者、服务器管理员和整合包测试人员。
✨ 功能
一键清空容器:使用 /clearallchests 命令立即移除世界中所有已加载的箱子、陷阱箱、桶和潜影盒中的所有物品。
基于概率的物品填充:使用 /fillchests 命令以自定义概率随机填充你选择的物品到容器中。
完全可自定义的物品:指定任何原版物品,并配置数量范围(例如 minecraft:diamond:1-3)。
完整的 NBT 支持:支持与 /give 命令相同的 NBT 格式——添加附魔、药水效果、自定义名称等。
即时生效,无需重载:命令立即生效;无需服务器重载或区块重载。
性能影响极低:仅遍历当前已加载的区块,保持轻量且高效。
? 命令
命令 参数 描述
/clearallchests 无 清除所有已加载区块中每个容器内的物品
/fillchests <概率> <物品列表> 以指定概率向容器中填充随机物品
所需权限:操作员(等级 ≥ 2)
? 使用方法
清空所有箱子
/clearallchests
执行后,所有已加载的箱子将被立即清空。聊天栏会显示被清空的容器数量。
用物品填充箱子
基本用法——普通物品
text
/fillchests 0.8 minecraft:diamond:1-3, minecraft:iron_ingot:5-10
这意味着 80% 的箱子将随机获得钻石(1–3 个)或铁锭(5–10 个)。
高级用法——带有 NBT 数据的物品
text
/fillchests 0.5 minecraft:diamond_sword:1 {Damage:0,Enchantments:[{id:"minecraft:sharpness",lvl:3}]}, minecraft:potion:1 {Potion:"minecraft:strong_healing"}
这意味着 50% 的箱子将被填充为锋利 III 附魔的钻石剑,或瞬间治疗 II 药水。
参数详情
概率:一个介于 0.0 和 1.0 之间的浮点数
0.0 = 不修改任何箱子
0.5 = 大约一半的箱子会被修改
1.0 = 所有箱子都会被填满
物品列表格式:
text
namespace:item_id:min-max [可选 NBT]
多个物品之间用逗号 , 分隔
NBT 的语法与 /give 命令相同
数量会在给定范围内随机生成
? 使用场景
冒险地图制作 – 快速为地牢宝箱填充战利品
服务器活动 – 刷新全服所有宝箱,用于限时活动
生存服务器管理 – 定期清理公共宝箱,防止玩家囤积物品
整合包测试 – 无需手动放置即可向容器中填入测试物品
小游戏世界 – 随机化资源分布,增加重玩价值
? 安装
安装 Minecraft 1.20.1 和 Fabric Loader 0.14.21 或更高版本
安装 Fabric API
将模组的 .jar 文件放入 .minecraft/mods/ 文件夹
启动游戏,进入一个世界,然后使用相关命令
⚙️ 兼容性
Minecraft:1.20.1
加载器:Fabric 0.14.21+
必需依赖项:Fabric API
专用服务器:✅ 支持
单人游戏:✅ 支持(需开启作弊)
? 注意事项
命令仅影响当前已加载区块中的容器。未加载的区域不会被处理。
如果世界中包含大量宝箱,建议在服务器负载较低时运行命令,以避免短暂卡顿。
/fillchests 会在重新填充之前清空容器的现有物品。请谨慎使用。
使用 NBT 标签时,请确保格式正确;否则物品可能无法生成。
?️ 截图(建议)
清空命令反馈 填充命令反馈
[截图 1:/clearallchests 结果] [截图 2:/fillchests 结果]
[截图 3:清空前后的宝箱对比] [截图 4:包含 NBT 物品的宝箱]
❓ 常见问题
Q:有些宝箱没有被清空/填充。为什么?
A:该命令仅处理已加载的区块。请靠近宝箱以加载其所在区块,或在服务器上启用世界预加载模组。
Q:我可以只针对特定区域而不是整个世界吗?
A:当前版本全局生效。未来更新计划支持按区域指定目标。
Q:是否支持战利品表(loot tables)?
A:目前物品直接在命令中定义。战利品表集成已在开发路线图中。
? 链接
Fabric API:
? 许可证
本项目采用 MIT 许可证授权。您可以自由使用、修改和分发本作品,但需保留原始作者声明,并以相同许可证发布您的修改版本。
ChestLootControl - Chest Loot Control
? Introduction
ChestLootControl is a lightweight Fabric admin utility mod that gives you full control over the items inside all chests in the world through simple commands. Clear every container in one go, or randomly refill them with fully customizable items—including full NBT support. Perfect for map makers, server admins, and modpack testing.
✨ Features
One-click container clearing: Use /clearallchests to instantly remove all items from every loaded chest, trapped chest, barrel, and shulker box in the world.
Probability-based item filling: Use /fillchests to randomly fill containers with your choice of items at a custom probability.
Fully customizable items: Specify any vanilla item with a configurable quantity range (e.g., minecraft:diamond:1-3).
Full NBT support: Supports the same NBT format as the /give command—add enchantments, potion effects, custom names, and more.
Instant effect, no reloads: Commands take effect immediately; no server reload or chunk reloading required.
Low performance impact: Only iterates over currently loaded chunks, keeping things lightweight and efficient.
? Commands
Command Parameters Description
/clearallchests None Clears all items from every container in all loaded chunks
/fillchests <probability> <item list> Fills containers with random items at the specified probability
Permission required: Operator (level ≥ 2)
? Usage
Clear all chests
text
/clearallchests
After execution, all loaded chests are emptied instantly. The chat will display the number of containers cleared.
Fill chests with items
Basic usage – plain items
text
/fillchests 0.8 minecraft:diamond:1-3, minecraft:iron_ingot:5-10
This means 80% of chests will randomly receive either diamonds (1–3) or iron ingots (5–10).
Advanced usage – items with NBT
text
/fillchests 0.5 minecraft:diamond_sword:1 {Damage:0,Enchantments:[{id:"minecraft:sharpness",lvl:3}]}, minecraft:potion:1 {Potion:"minecraft:strong_healing"}
This means 50% of chests will be filled with a Sharpness III diamond sword or an instant health II potion.
Parameter details
Probability: A float between 0.0 and 1.0
0.0 = no chests are modified
0.5 = roughly half of all chests
1.0 = every chest is filled
Item list format:
text
namespace:item_id:min-max [optional NBT]
Multiple items are separated by a comma ,
NBT follows the same syntax as the /give command
Quantities are rolled randomly within the given range
? Use Cases
Adventure map creation – Quickly populate dungeon chests with loot
Server events – Refresh all chests across the server for limited-time events
Survival server management – Periodically clear public chests to prevent item hoarding
Modpack testing – Fill containers with test items without placing them manually
Minigame worlds – Randomize resource distribution for extra replayability
? Installation
Install Minecraft 1.20.1 and Fabric Loader 0.14.21 or newer
Install Fabric API
Place the mod's .jar file into your .minecraft/mods/ folder
Launch the game, enter a world, and use the commands
⚙️ Compatibility
Minecraft: 1.20.1
Mod loader: Fabric 0.14.21+
Required dependency: Fabric API
Dedicated server: ✅ Supported
Singleplayer: ✅ Supported (cheats must be enabled)
? Notes
Commands only affect containers in currently loaded chunks. Unloaded areas are not processed.
If the world contains a very large number of chests, consider running commands during low server activity to avoid brief lag.
/fillchests will clear the container's existing items before refilling it. Use with care.
When using NBT tags, make sure the format is correct; otherwise the item may fail to generate.
?️ Screenshots (Suggested)
Clear command feedback Fill command feedback
[Screenshot 1: /clearallchests result] [Screenshot 2: /fillchests result]
[Screenshot 3: Chest before/after clearing] [Screenshot 4: Chest containing NBT items]
❓ FAQ
Q: Some chests weren't cleared/filled. Why?
A: The command only processes loaded chunks. Move closer to the chests to load their chunks, or use a world preloader mod on servers.
Q: Can I target only a specific area instead of the whole world?
A: The current version works globally. Area-specific targeting is planned for a future update.
Q: Does it support loot tables?
A: Currently, items are defined directly in the command. Loot table integration is on the roadmap.
? Links
Fabric API:
? License
This project is licensed under the MIT License. You are free to use, modify, and distribute it, as long as you retain the original author notice and release your modifications under the same license.
评论 0
登录后参与评分
还没有评论,来抢沙发吧