Item Sweeper
服务器里掉落的物品太多导致卡顿?Item Sweeper 会在计时器触发时清理它们——并且会提前发出警告。
一个轻量级的原版数据包。将其放入你世界的 datapacks 文件夹即可。玩家无需安装任何内容。
更偏好模组?在“版本”选项卡中,该数据包也可作为 Fabric(需要 Fabric API)或 NeoForge 模组使用。无需同时安装两者。
功能
- 每 5 分钟 清理那些在地上停留至少 30 秒 的掉落物。
在清理前刚刚掉落的物品会被保留。
- 在每次清理前的 60 秒和 10 秒 向所有玩家的聊天栏发送警告,随后报告清理了多少物品。
- 还会清除 插在地上的箭。经验球可选(默认关闭)。
- 以上所有内容均可更改或关闭。
它绝不会触碰的内容
- 无法拾取的展示物品(来自其他数据包的商店、装饰等)
- 设置为永不消失的物品
- 带有
item_sweeper.keep 标签的任何物品——其他数据包可以使用此标签来保护它们的物品
对服务器的负担极轻
仅加载的区块会被扫描——就像原版物品的消失机制一样,未加载区块中的物品不会被处理。
无论有多少物品,一次清理只是一组少量的命令。
在测试中,单次清理可清除 16,000 个物品,且不会出现命令数量限制问题。
命令(仅限管理员)
| 命令 |
作用 |
/function item_sweeper:settings |
显示设置及距离下次清理的时间 |
/function item_sweeper:sweep_now |
立即清理掉落物 |
/function item_sweeper:uninstall |
移除该数据包添加的所有内容 |
设置
/scoreboard players set #<name> item_sweeper.config <value>
| 名称 |
默认值 |
含义 |
enabled |
1 |
1 = 开启,0 = 关闭 |
interval |
300 |
两次清理之间的间隔秒数(0 = 关闭) |
min_age |
30 |
物品必须在地上停留的秒数 |
warn_1 / warn_2 |
60 / 10 |
警告时间(秒)(0 = 无警告) |
arrows |
1 |
清除插在地上的箭 |
xp_orbs |
0 |
清除经验球 |
announce |
1 |
聊天警告和总结信息 |
设置项在 /reload 后依然保留。
翻译
聊天消息使用翻译键(item_sweeper.warn、item_sweeper.done、item_sweeper.done_with_others),并配有英文回退文本,因此资源包可以对其进行翻译。
测试环境
Minecraft 26.1、26.2 和 26.3(专用服务器)。
欢迎提交错误报告,但回复可能较慢。
Item Sweeper
Too many dropped items lagging your server? Item Sweeper clears them on a timer — with a warning first.
A small, vanilla data pack. Drop it in your world's datapacks folder. Players don't need to install anything.
Prefer mods? The same pack is also available as a Fabric (needs Fabric API) or NeoForge mod on the Versions tab. There is no need to install both.
What it does
- Every 5 minutes, clears dropped items that have been lying around for at least 30 seconds.
Items dropped right before a sweep are left alone.
- Warns everyone in chat 60 and 10 seconds before each sweep, then reports how much was cleared.
- Also clears arrows stuck in the ground. XP orbs are optional (off by default).
- All of this can be changed or turned off.
What it never touches
- Display items that can't be picked up (shops, decorations from other packs)
- Items set to never despawn
- Anything tagged
item_sweeper.keep — other packs can use this tag to protect their items
Light on your server
Only loaded chunks are swept — like vanilla despawning, items in unloaded chunks are left alone.
One sweep is a handful of commands no matter how many items there are.
In testing, 16,000 items were cleared in a single sweep with no command-limit issues.
Commands (operators)
| Command |
What it does |
/function item_sweeper:settings |
Show settings and time until the next sweep |
/function item_sweeper:sweep_now |
Clear dropped items now |
/function item_sweeper:uninstall |
Remove everything the pack added |
Settings
/scoreboard players set #<name> item_sweeper.config <value>
| Name |
Default |
Meaning |
enabled |
1 |
1 = on, 0 = off |
interval |
300 |
Seconds between sweeps (0 = off) |
min_age |
30 |
Seconds an item must have been on the ground |
warn_1 / warn_2 |
60 / 10 |
Warning times in seconds (0 = no warning) |
arrows |
1 |
Clear arrows stuck in the ground |
xp_orbs |
0 |
Clear XP orbs |
announce |
1 |
Chat warnings and summary |
Settings survive /reload.
Translations
Chat messages use translation keys (item_sweeper.warn, item_sweeper.done, item_sweeper.done_with_others) with English fallbacks, so resource packs can translate them.
Tested on
Minecraft 26.1, 26.2 and 26.3 (dedicated server).
Bug reports are welcome, but replies may be slow.
评论 0
登录后参与评分
还没有评论,来抢沙发吧