设计思路、原理及构想由人类完成
编码与实现由 AI 完成
? 智能物品清理器 v2
专为 NeoForge 1.21.1 打造的轻量级智能物品清理系统
? 概述
Smart Item Deleter v2 是一款服务器端优化模组,旨在当掉落物实体数量超过设定阈值时,自动清理这些实体。
它单独追踪每个物品,以确保公平、高效且安全的移除操作——仅删除过量、陈旧且不重要的掉落物,而不干扰正常游戏进程。
✅ 支持 NeoForge 21.1.215, Youer 1.21.1, AsyncYouer-1.21.1
⚙️ 专为基于 Create 和重度整合包的生存服务器设计
? 低开销,确定性的清理周期
⚙️ 配置(面向服务器管理员)
配置文件:
config/smart_item_deleter_v2-common.toml
| 选项 | 类型 | 默认值 | 描述 |
|---|---|---|---|
entityCountThreshold |
int |
200 |
激活清理功能前所需的掉落物实体数量。 |
minItemAgeMs |
long |
15000 |
物品有资格被删除前的最小年龄(毫秒)。防止立即移除新掉落的物品。 |
scanIntervalTicks |
int |
20 |
系统扫描世界查找物品的频率(以刻为单位)(20 刻 = 1 秒)。 |
scanJitterEnabled |
boolean |
true |
在间隔时间上添加小的随机偏移量(±scanJitterTicks),以减少多个模组同时行动时导致的服务器 Tick 尖峰。 |
scanJitterTicks |
int |
2 |
每次清理周期计时中可添加/减去的最大抖动值。 |
consoleDebugLogging |
boolean |
true |
当设置为 false 时,抑制服务器控制台中显示的清理摘要消息。 |
deletePercentage |
int |
90 |
每个周期要删除的符合条件物品的百分比(0–100)。即使超过阈值,也能保护最新生成的物品。 |
whitelistMode |
boolean |
false |
切换白名单(true)或黑名单(false)过滤行为。 |
filteredItems |
list |
[] |
接受精确的物品 ID(如 minecraft:stone)、标签引用(如 #forge:ingots)或使用 */? 的通配符模式(例如 minecraft:*, minecraft:oak*),用于定义受保护(黑名单)或目标(白名单)的物品。 |
示例:
entityCountThreshold = 250
minItemAgeMs = 15000
scanIntervalTicks = 20
deletePercentage = 80
whitelistMode = false
filteredItems = ["minecraft:nether_star", "minecraft:diamond"]
通配符示例
filteredItems = ["minecraft:oak*"]
此配置意味着:
- 清理程序大约每秒运行一次。
- 仅在存在超过 250 个掉落物时开始执行。
- 删除所有超过 15 秒历史的物品的 80%(优先处理最旧的物品)。
- 钻石和下界之星永远不会被删除。
? 技术细节(面向开发者和维护者)
核心行为
- 物品在
TrackedItemsData中进行追踪,使用持久化的每层级存储。 - 每个物品存储以下信息:
UUIDdimension(维度)firstSeenMs(首次检测到的时间)lastSeenMs(最后确认的时间)
- 仅当总物品数量超过配置的阈值时,才会发生清理。
- 物品符合删除条件需满足:
- 其年龄 ≥
minItemAgeMs - 通过当前的策略过滤器(黑名单/白名单模式)
- 其年龄 ≥
- 当启用
protectNamedItems时,拥有自定义名称的物品将被完全忽略——它们不计入阈值,也永远不会被删除。
删除逻辑
- 所有符合条件的物品按 从旧到新 排序(即按
firstSeenMs升序排列)。 - 每个周期的删除数量为:
deletions = min(excess_items, eligible_items * (deletePercentage / 100)) - 这确保了:
- 服务器保持稳定的 Tick 时间。
- 玩家近期的掉落物得以保留。
- 不断溢出物品的自动化机器保持整洁。
抖动(扫描去同步化)
- 系统使用随机间隔:
以避免多个模组或系统运行定期更新时同时产生沉重的 Tick 爆发。nextInterval = scanIntervalTicks ± scanJitterTicks
代码结构
| 包名 | 用途 |
|---|---|
core/ |
清理逻辑、Tick 处理、过滤和执行 |
persist/ |
持久化追踪数据 (SavedData),用于每世界存储 |
config/ |
配置规范及加载 |
command/ |
可选的 /cleanup 管理员命令,用于手动触发 |
命令
| 命令 | 描述 |
|---|---|
/cleanup run |
强制手动运行一次清理周期。 |
/cleanup status |
(计划中)显示追踪的物品数量、符合条件的物品数及当前阈值。 |
/cleanup config |
动态更改配置文件中的数值。 |
? 未来计划
- 仅通过动作栏或服务器控制台提供游戏内反馈
- 将指标暴露给
/cleanup status或与记分板兼容的数据点
? 许可证
MIT License — 可自由使用和修改。
如果重新分发,请注明作者 Metl_Play。
如果在整合包中提到我,将不胜感激,但这并非必需。
? 鸣谢
- 开发者: Metl_Play
- Minecraft: 1.21.1 (NeoForge)
- 映射: Parchment mappings
- 库: NeoForge API, 标准 Java 集合
“这不仅仅是一个清洁模组——它是一个更聪明的清洁工。” ??
How it should work, why and the idea are done by Human
Coded and implemented by AI
? Smart Item Deleter v2
A lightweight, intelligent item cleanup system for NeoForge 1.21.1
? Overview
Smart Item Deleter v2 is a server-side optimization mod designed to automatically clean up dropped item entities when the item count exceeds a defined threshold.
It tracks items individually to ensure fair, efficient, and safe removal — deleting only excess, old, and unimportant drops without disrupting normal gameplay.
✅ Supports NeoForge 21.1.215, Youer 1.21.1, AsyncYouer-1.21.1
⚙️ Designed for Create-based and heavily modded survival servers
? Low overhead, deterministic cleanup cycles
⚙️ Configuration (for server owners)
Configuration file:
config/smart_item_deleter_v2-common.toml
| Option | Type | Default | Description |
|---|---|---|---|
entityCountThreshold |
int |
200 |
Number of dropped item entities required before cleanup activates. |
minItemAgeMs |
long |
15000 |
Minimum age (in milliseconds) before an item becomes eligible for deletion. Prevents immediate removal of new drops. |
scanIntervalTicks |
int |
20 |
How often (in ticks) the system scans the world for items (20 ticks = 1 second). |
scanJitterEnabled |
boolean |
true |
Adds small random offset (±scanJitterTicks) to interval to reduce server tick spikes when multiple mods act simultaneously. |
scanJitterTicks |
int |
2 |
Maximum jitter added/subtracted from each cleanup cycle’s timing. |
consoleDebugLogging |
boolean |
true |
When false, suppresses cleanup summary messages in the server console. |
deletePercentage |
int |
90 |
Percentage of eligible items to delete each cycle (0–100). Protects the newest items even when threshold is exceeded. |
whitelistMode |
boolean |
false |
Toggles whitelist (true) or blacklist (false) filtering behavior. |
filteredItems |
list |
[] |
Accepts exact item IDs (minecraft:stone), tag references (#forge:ingots), or wildcard globs with */? (e.g., minecraft:*, minecraft:oak*) that define which items are protected (blacklist) or targeted (whitelist). |
Example:
entityCountThreshold = 250
minItemAgeMs = 15000
scanIntervalTicks = 20
deletePercentage = 80
whitelistMode = false
filteredItems = ["minecraft:nether_star", "minecraft:diamond"]
Wildcard example
filteredItems = ["minecraft:oak*"]
This configuration means:
- Cleanup runs roughly every second.
- Only starts when >250 dropped items exist.
- Deletes 80% of all items older than 15 seconds (prioritizing the oldest).
- Diamonds and Nether Stars will never be deleted.
? Technical Details (for developers and maintainers)
Core Behavior
- Items are tracked in
TrackedItemsData, using persistent per-level storage. - Each item stores:
UUIDdimensionfirstSeenMs(time first detected)lastSeenMs(time last confirmed)
- Cleanup only occurs when the total item count exceeds the configured threshold.
- Items are eligible if:
- Their age ≥
minItemAgeMs - They pass the current policy filter (blacklist/whitelist mode)
- Their age ≥
- When
protectNamedItemsis enabled, items with custom names are ignored entirely — they do not count toward the threshold and are never deleted.
Deletion Logic
- All eligible items are sorted oldest first (ascending by
firstSeenMs). - The number of deletions per cycle is:
deletions = min(excess_items, eligible_items * (deletePercentage / 100)) - This ensures:
- The server maintains stable tick times.
- Recent player drops are preserved.
- Automated machines that constantly spill items are kept clean.
Jitter (scan desynchronization)
- The system uses a randomized interval of:
to avoid simultaneous heavy-tick bursts when multiple mods or systems run periodic updates.nextInterval = scanIntervalTicks ± scanJitterTicks
Code Structure
| Package | Purpose |
|---|---|
core/ |
Cleanup logic, ticking, filtering, and execution |
persist/ |
Persistent tracking data (SavedData) for per-world storage |
config/ |
Configuration spec and loading |
command/ |
Optional /cleanup admin command for manual triggering |
Commands
| Command | Description |
|---|---|
/cleanup run |
Forces a cleanup cycle manually. |
/cleanup status |
(Planned) Displays tracked item count, eligible items, and current thresholds. |
/cleanup config |
Changes values in the config on the fly. |
? Future Plans
- Provide in-game feedback via action bar or server console only
- Expose metrics to
/cleanup statusor a scoreboard-compatible data point
? License
MIT License — freely usable and modifiable.
Please credit Metl_Play if redistributed.
Would be appreciated if I am mentioned in modpacks, but it's not required.
? Credits
- Developer: Metl_Play
- Minecraft: 1.21.1 (NeoForge)
- Mappings: Parchment mappings
- Libraries: NeoForge API, standard Java collections
“It’s not just a cleaner mod — it’s a smarter janitor.” ??
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
下载 Smart item deleter V2
0.4.9-neoforged - 2026-01-19
自 0.4.5-neoforged 以来的更改。
已更改
- 过滤规则现在在配置烘焙时预编译(标签/精确匹配/通配符),并在匹配过程中复用。
- 清理日志写入已通过单线程后台写入器移至 tick 线程之外。
- 追踪的物品年龄会被限制,以避免重启后出现负值;服务器启动时会清除追踪数据。
- 追踪物品地图访问器返回不可修改的视图;无效维度 ID 将回退至主世界。
- 模组徽标现在使用 JAR 根目录下的
icon.png(256x256 RGBA)。 - 更新加载器版本范围为
[2,)。
已移除
- 移除了旧的
Smart-Item-Deleter-v2-new.png徽标资源。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
缓冲的原始输入和线程化的事件轮询
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
原版世界生成优化模组
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
评论 0
登录后参与评分
还没有评论,来抢沙发吧