Cleardrops
一个仅适用于服务端的 Forge 1.20.1 模组,用于将掉落的物品清理到共享回收站中。它支持自动/手动收集、通过原版箱子 GUI 检索、可热重载的配置、渐变颜色消息、物品黑名单、收集前警告以及虚空物品保护。兼容原版客户端——无需安装客户端模组。
- Minecraft: 1.20.1
- Forge: 47.4.x
- Java: 17
- Mod ID:
cleardrops
- 客户端依赖:无(原版客户端可以加入并使用 GUI)
功能特性
- 自动定期清理世界中的物品实体(可配置间隔和开关)
- 通过命令手动清理
- 回收站(54 格),通过原版 6 行容器打开
- 配置热重载:编辑并保存
world/serverconfig/cleardrops-server.toml,或运行 /cleardrops reload
- 完全可配置的消息(中文/英文或任何语言),支持渐变颜色
- 可配置的秒数级收集前警告
- 物品黑名单:
- 黑名单上的物品不会从世界中收集
- 黑名单上的物品在清空回收站时也会被跳过(此模组永远不会销毁它们)
- 虚空物品保护:落入虚空的物品会被传送回安全高度
安装
- 将模组 jar 文件放入服务器的
mods/ 文件夹中。
- 启动服务器一次以生成配置文件。
- 根据您的需要编辑
<WORLD>/serverconfig/cleardrops-server.toml。
- 保存配置文件即可即时热重载;或者运行
/cleardrops reload。
命令
/cleardrops help — 显示帮助(使用可配置的渐变样式文本)
/cleardrops gui — 打开回收站(原版箱子 GUI)
/cleardrops status — 显示当前库存、倒计时和开关状态
/cleardrops collect — 立即收集掉落的物品(权限等级 ≥ 2)
/cleardrops purge — 立即清空回收站(权限等级 ≥ 2;黑名单物品会被跳过)
/cleardrops reload — 从 TOML 重新加载配置(权限等级 ≥ 2)
权限遵循服务器的标准 OP 等级 (hasPermission(2))。
配置(支持热重载)
路径:<WORLD>/serverconfig/cleardrops-server.toml
保存文件即可即时应用(热重载),或运行 /cleardrops reload。
[general]
# 启用定期自动收集掉落物品。
enableAutoCollect = true
# 自动收集之间的刻数。20 刻 = 1 秒。
ticksPerCollect = 6000
# 收集后在回收站中保留物品的刻数,之后进行清空。
ticksKeepAfterCollect = 2400
# 向在线玩家广播消息(警告、已收集、已清空等)。
announceMessages = true
[blacklist]
# 物品 ID(例如 minecraft:nether_star)。黑名单物品不会被收集,
# 并且在清空时也会被跳过(此模组永远不会销毁它们)。
items = ["minecraft:nether_star", "minecraft:totem_of_undying"]
[void_protection]
# 将落入虚空的物品拉回到世界的最低建筑高度区域。
enableVoidProtect = true
# 查找安全空气位置的最大向上步数(以方块为单位)。
raiseMaxSteps = 6
# 从虚空中救援时重置物品速度。
resetVelocity = true
[messages]
# 消息前缀(支持渐变标签)。示例:
prefix = "<gradient:#00E5FF:#00FF7F>[Cleardrops]</gradient>"
# 收集前警告秒数。
warnSeconds = [60, 30, 10, 5, 4, 3, 2, 1]
# 警告消息模板(占位符:{time})
msgPreCollect = "正在在 {time} 秒内收集掉落物品。请拾取贵重物品!"
# 自动收集完成(占位符:{entities}, {keep})
msgCollected = "已收集 {entities} 个物品实体。请使用 /cleardrops gui 进行检索。将在 {keep} 秒后清空。"
# 清空完成(占位符:{slots})
msgPurged = "回收站已清空。清除了 {slots} 个槽位。"
# 状态(占位符:{slotsUsed}, {slotsTotal}, {items}, {keep}, {auto}, {interval}, {keepCfg}, {announce})
msgStatus = "回收站:{slotsUsed}/{slotsTotal} 个槽位,{items} 个物品;将在 {keep} 后清空;自动={auto},间隔={interval}秒,保留={keepCfg}秒,广播={announce}。"
# 帮助(支持渐变和 \n 换行)
msgHelp = "<gradient:#7AD7F0:#4FC3F7>Cleardrops 帮助</gradient>\n<gradient:#A8FF78:#78FFD6>/cleardrops gui</gradient> - 打开回收站\n<gradient:#A8FF78:#78FFD6>/cleardrops status</gradient> - 显示状态\n<gradient:#FFD54F:#FF8A00>/cleardrops collect</gradient> - 立即收集 (权限 2)\n<gradient:#FFD54F:#FF8A00>/cleardrops purge</gradient> - 立即清空 (权限 2)\n<gradient:#B388FF:#7C4DFF>/cleardrops reload</gradient> - 重载配置 (权限 2)"
# 手动命令反馈
# /cleardrops collect(占位符:{entities}, {keep})
msgCmdCollect = "已收集 {entities} 个物品实体。您有 {keep} 秒时间从回收站中取回它们。"
# /cleardrops purge(占位符:{slots})
msgCmdPurge = "回收站已清空:清除了 {slots} 个槽位。黑名单物品已被跳过。"
消息格式
- 渐变标签:
- 语法:
<gradient:#RRGGBB:#RRGGBB>文本</gradient>
- 颜色通过线性插值逐字符应用。
- 适用于
prefix、msgHelp 和任何消息模板。
- 占位符:
- 警告:
{time}
- 已收集:
{entities}, {keep}
- 已清空:
{slots}
- 状态:
{slotsUsed}, {slotsTotal}, {items}, {keep}, {auto}, {interval}, {keepCfg}, {announce}(如果添加到模板中,还可以选择性地使用 {blacklistedStacks})
黑名单与虚空保护
- 黑名单:
- 列表中的物品在清理期间不被收集(留在世界中)。
- 回收站中处于黑名单的物品不被清空(此模组永远不会销毁它们)。
- 虚空保护:
- 检测低于最低建筑高度的物品实体,并将它们传送到安全的空气位置。
- 可配置最大提升步数以及是否归零速度。
常见问题
- 客户端需要安装该模组吗?
- 不需要。这是服务端专用模组。其用户界面使用原版的箱子容器。
- 与其他清理类模组冲突吗?
- 多个清理系统可能会重叠。建议只保留一个主要的清理模组,或错开它们的执行时间。
- 配置更改未生效?
- 请确保编辑当前世界的
serverconfig/cleardrops-server.toml 文件。保存即可热重载,或者运行 /cleardrops reload 命令。
开发
- JDK 17, Forge 1.20.1 (47.4.x)
- 构建:
./gradlew build(构建产物位于 build/libs/ 目录下)
- 核心包:
cn.alini.cleardrops.server.ServerScheduler — 核心调度、收集/清除、警告、虚空保护、黑名单
cn.alini.cleardrops.config.CDConfig — 配置规范与热重载
cn.alini.cleardrops.command.CleardropsCommands — 命令注册与处理
cn.alini.cleardrops.util.MessageUtil — 渐变色渲染与占位符
cn.alini.cleardrops.storage.TrashStorage — 回收站存储
许可
本项目遵循 Creative Commons Attribution 4.0 International (CC BY 4.0) 许可证。详见 LICENSE。
只要您提供适当的署名,您可以复制、修改和分发本项目。
Cleardrops
A server-side-only Forge 1.20.1 mod that cleans up dropped items into a shared recycle bin. It supports automatic/manual collection, retrieval via the vanilla chest GUI, hot‑reloadable configuration, gradient‑colored messages, an item blacklist, pre‑collection warnings, and void item protection. Works with vanilla clients—no client mod required.
- Minecraft: 1.20.1
- Forge: 47.4.x
- Java: 17
- Mod ID:
cleardrops
- Client dependency: None (vanilla clients can join and use the GUI)
Features
- Automatic periodic cleanup of world item entities (configurable interval and toggle)
- Manual cleanup via command
- Recycle Bin (54 slots), opened with the vanilla 6‑row chest container
- Config hot reload: edit and save
world/serverconfig/cleardrops-server.toml, or run /cleardrops reload
- Fully configurable messages (Chinese/English or any language), with gradient color support
- Pre‑collection warnings at configurable second marks
- Item blacklist:
- Blacklisted items will not be collected from the world
- Blacklisted items are also skipped when purging the recycle bin (never destroyed by this mod)
- Void item protection: items falling into the void are teleported back up to a safe height
Installation
- Place the mod jar into your server’s
mods/ folder.
- Launch the server once to generate the config.
- Edit
<WORLD>/serverconfig/cleardrops-server.toml to your needs.
- Config is hot‑reloaded on save; alternatively, run
/cleardrops reload.
Commands
/cleardrops help — Show help (uses configurable, gradient‑styled text)
/cleardrops gui — Open the recycle bin (vanilla chest GUI)
/cleardrops status — Show current inventory, countdowns, and toggles
/cleardrops collect — Collect dropped items immediately (permission level ≥ 2)
/cleardrops purge — Purge the recycle bin immediately (permission level ≥ 2; blacklist is skipped)
/cleardrops reload — Reload config from TOML (permission level ≥ 2)
Permissions follow the server’s standard op levels (hasPermission(2)).
Configuration (with Hot Reload)
Path: <WORLD>/serverconfig/cleardrops-server.toml
Save the file to apply instantly (hot reload), or run /cleardrops reload.
[general]
# Enable periodic automatic collection of dropped items.
enableAutoCollect = true
# Ticks between automatic collections. 20 ticks = 1 second.
ticksPerCollect = 6000
# Ticks to keep items in the recycle bin after a collection before purging.
ticksKeepAfterCollect = 2400
# Broadcast messages (warnings, collected, purged, etc.) to online players.
announceMessages = true
[blacklist]
# Item IDs (e.g., minecraft:nether_star). Blacklisted items will not be collected,
# and will be skipped during purge as well (never destroyed by this mod).
items = ["minecraft:nether_star", "minecraft:totem_of_undying"]
[void_protection]
# Pull items falling into the void back up to the world's min build height area.
enableVoidProtect = true
# Max upward steps (in blocks) to find a safe air position.
raiseMaxSteps = 6
# Reset item velocity when rescued from the void.
resetVelocity = true
[messages]
# Message prefix (supports gradient tags). Example:
prefix = "<gradient:#00E5FF:#00FF7F>[Cleardrops]</gradient>"
# Pre-collection warning seconds.
warnSeconds = [60, 30, 10, 5, 4, 3, 2, 1]
# Warning message template (placeholders: {time})
msgPreCollect = "Collecting dropped items in {time}s. Please pick up valuables!"
# Auto-collection complete (placeholders: {entities}, {keep})
msgCollected = "Collected {entities} item entities. Use /cleardrops gui to retrieve. Purging in {keep}s."
# Purge complete (placeholders: {slots})
msgPurged = "Recycle bin purged. Cleared {slots} slot(s)."
# Status (placeholders: {slotsUsed}, {slotsTotal}, {items}, {keep}, {auto}, {interval}, {keepCfg}, {announce})
msgStatus = "Recycle Bin: {slotsUsed}/{slotsTotal} slots, {items} items; Purge in {keep}; Auto={auto}, Interval={interval}s, Keep={keepCfg}s, Announce={announce}."
# Help (supports gradient and \n newlines)
msgHelp = "<gradient:#7AD7F0:#4FC3F7>Cleardrops Help</gradient>\n<gradient:#A8FF78:#78FFD6>/cleardrops gui</gradient> - Open recycle bin\n<gradient:#A8FF78:#78FFD6>/cleardrops status</gradient> - Show status\n<gradient:#FFD54F:#FF8A00>/cleardrops collect</gradient> - Collect now (perm 2)\n<gradient:#FFD54F:#FF8A00>/cleardrops purge</gradient> - Purge now (perm 2)\n<gradient:#B388FF:#7C4DFF>/cleardrops reload</gradient> - Reload config (perm 2)"
# Manual command feedback
# /cleardrops collect (placeholders: {entities}, {keep})
msgCmdCollect = "Collected {entities} item entities. You have {keep}s to retrieve them from the bin."
# /cleardrops purge (placeholders: {slots})
msgCmdPurge = "Recycle bin purged: {slots} slot(s) cleared. Blacklisted items were skipped."
Message Formatting
- Gradient tag:
- Syntax:
<gradient:#RRGGBB:#RRGGBB>text</gradient>
- Colors are applied per character via linear interpolation.
- Works in
prefix, msgHelp, and any message template.
- Placeholders:
- Warnings:
{time}
- Collected:
{entities}, {keep}
- Purged:
{slots}
- Status:
{slotsUsed}, {slotsTotal}, {items}, {keep}, {auto}, {interval}, {keepCfg}, {announce} (and optionally {blacklistedStacks} if you add it to your template)
Blacklist and Void Protection
- Blacklist:
- Items on the list are NOT collected during cleanup (left in the world).
- Items in the recycle bin that are blacklisted are NOT purged (never destroyed by this mod).
- Void Protection:
- Detects item entities below the min build height and teleports them up to a safe air position.
- Configurable maximum raise steps and whether to zero velocity.
FAQ
- Do clients need the mod installed?
- No. This is server‑only. The UI uses the vanilla chest container.
- Conflicts with other cleanup mods?
- Multiple cleanup systems may overlap. Prefer one primary cleaner or stagger schedules.
- Config changes don’t apply?
- Make sure you edit the current world’s
serverconfig/cleardrops-server.toml. Save to hot reload, or run /cleardrops reload.
Development
- JDK 17, Forge 1.20.1 (47.4.x)
- Build:
./gradlew build (artifacts under build/libs/)
- Key packages:
cn.alini.cleardrops.server.ServerScheduler — core scheduling, collection/purge, warnings, void protection, blacklist
cn.alini.cleardrops.config.CDConfig — config spec and hot reload
cn.alini.cleardrops.command.CleardropsCommands — command registration and handlers
cn.alini.cleardrops.util.MessageUtil — gradient rendering and placeholders
cn.alini.cleardrops.storage.TrashStorage — recycle bin storage
License
This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0). See LICENSE for details.
You may copy, modify, and distribute this project as long as you provide proper attribution.
评论 0
登录后参与评分
还没有评论,来抢沙发吧