如果这个项目对您有帮助,请考虑在 GitHub 上留下星标!
Mob Despawn Fix
一款现代化、高性能的 Spigot/Paper 服务器优化插件,旨在消除因怪物拾取地面物品而导致的地下怪物堆积卡顿问题。
本项目受 frikinjay 的 Let Me Despawn 及其早期 Paper 分支(由 contionability 维护)启发。这是一个从头开始设计的现代化、干净的 Spigot/Paper 重写版本,旨在全面支持现代 Minecraft 版本(1.13.2 至 1.21+),同时确保世界完全无卡顿。
描述
在原版 Minecraft 中,每当敌对生物(如僵尸、骷髅或溺尸)走过并装备或拾取地上的任何掉落物时,原版游戏会将 PersistenceRequired: 1b(强制不消失标记)设置为 1。
由于这一机制,当玩家在某个区域长时间停留时,基地下方的黑暗洞穴和含水层会逐渐积累数十甚至数百只捡走了怪物掉落物(腐肉、箭矢、骨头)、鸡骑士蛋或破碎砾石的怪物。
这些怪物:
- 玩家离开时不会自然消失。
- 不计入自然生成上限,允许新怪物不断生成并加入这支永久存在的军团。
- 持续消耗服务器 CPU 刻,用于计算寻路、视线检测和碰撞,随着长期生存世界的推进,逐渐降低 TPS 并导致严重的实体卡顿。
Mob Despawn Fix 动态覆盖此持久化机制,允许囤积垃圾物品的怪物像普通怪物一样自然消失,而无需担心玩家装备、命名生物或农场的安全。
功能
- 自然消失: 拾取地面物品的敌对生物仍受标准原版消失距离的限制(当玩家移动超过 32–128+ 格时自然消失),而不是变得永久持久存在。
- 默认安全(白名单模式): 开箱即用配置为
mode: whitelist(白名单模式)。仅允许自然生成的洞穴碎片和怪物掉落物(rotten_flesh、bone、arrow、egg、string、spider_eye、gunpowder、gravel、dirt、torch 等)让怪物消失。
- 玩家装备保护: 如果玩家在洞穴中死亡,且怪物捡起了他们的钻石/下界合金装备、工具或贵重物品,该怪物将保留完整的原版持久化状态,以便玩家返回并回收物品。
- 名牌与农场保护: 通过名牌赋予自定义名称的生物,或在铁砧中重命名了物品的生物将被严格保留。
- 载具保护: 位于船、矿车或任何载具内的生物受到保护,不会消失(非常适合铁傀儡农场、交易大厅和怪物笼子)。
- 回溯性清理洞穴: 当添加到已有数百只怪物在洞穴中囤积的已建立世界中时,插件会扫描加载的区块,并清除未命名囤积者身上的预存持久化标记。
- 实时游戏内诊断: 包含内置扫描工具(
/mdf info)以诊断加载区块中的囤积怪物,并提供手动清理命令(/mdf purge)。
命令与权限
所有命令均支持主命令 /mobdespawnfix 以及别名 /mdf 和 /ddespawn。
| 命令 |
描述 |
权限 |
/mdf info |
扫描加载的区块,报告总怪物数、持久化怪物和囤积者数量。 |
mobdespawnfix.use |
/mdf purge |
手动清理加载区块中不受保护的持久化囤积者。 |
mobdespawnfix.use |
/mdf reload |
重新加载 config.yml 并实时更新白名单/黑名单定义。 |
mobdespawnfix.use |
配置
# 模式可以是 'whitelist'(仅列出的物品允许消失)或 'blacklist'(除列出的物品外,所有物品都允许消失)
mode: whitelist
# 怪物拾取后允许其消失的物品列表(当 mode: whitelist 时使用)
whitelist:
- rotten_flesh
- bone
- arrow
- string
- spider_eye
- gunpowder
- slime_ball
- glow_ink_sac
- ink_sac
- ender_pearl
- egg
- feather
- raw_chicken
- gravel
- flint
- dirt
- cobblestone
- stone
- torch
- redstone_torch
- coal
- raw_copper
- raw_iron
- kelp
- seagrass
# 怪物拾取后永远不会消失的物品列表(当 mode: blacklist 时使用)
blacklist:
- diamond
- diamond_sword
- diamond_helmet
- diamond_chestplate
- diamond_leggings
- diamond_boots
- netherite_ingot
- netherite_sword
- netherite_helmet
- netherite_chestplate
- netherite_leggings
- netherite_boots
- totem_of_undying
- elytra
# 是否让载具中的怪物消失(船、矿车等)
despawn-vehicle: false
# 是否检查并消失那些因持有物品而被标记为持久化的现有怪物
retroactive-despawn-check: false
prevent-pickup-persistence: true
ignore-named-mobs: true
ignore-named-items: true
为什么要制作这个?
6 年前,我在 r/Minecraft 上发布了一篇帖子:
/effect give @e[nbt= {PersistenceRequired:1b}] minecraft:glowing
这不知为何返回了大约 600 个目标,并显示了许多从未消失的地底怪物。这开始让我的世界产生卡顿,我想知道为什么会发生这种情况。
多年来,生存世界和服务器一直深受这一机制之苦——僵尸在基地下方未点亮的洞穴中囤积鸡蛋、鸡骑士掉落物和散落的箭矢。
虽然原始的 Let Me Despawn 模组解决了 Forge/Fabric 上的这个问题,但 Paper/Spigot 插件版本已超过 4 年未更新。我们创建了这种现代化的干净实现,旨在用干净的代码、安全的默认设置和无冗余的特性来解决现代服务器的问题。
❤️ 致谢
If this project helped you, please consider leaving some stars on the Github!
Mob Despawn Fix
A modern, high-performance Spigot/Paper server optimization plugin that eliminates subterranean mob-hoarding lag caused by monsters picking up ground items.
Inspired by Let Me Despawn by frikinjay and its earlier Paper fork by contionability. This project is a modern, clean-room Spigot/Paper rewrite designed from the ground up to support modern Minecraft versions (1.13.2 through 1.21+) while keeping worlds completely lag-free.
Description
In vanilla Minecraft, whenever a hostile mob (such as a Zombie, Skeleton, or Drowned) walks over and equips or picks up any dropped item from the ground, vanilla sets PersistenceRequired: 1b
Because of this mechanic, when players spend extended periods of time in an area, dark caves and aquifers beneath their bases gradually accumulate dozens or even hundreds of monsters that scooped up mob drops (rotten flesh, arrows, bones), chicken jockey eggs, or broken gravel.
These monsters:
- Never despawn naturally when players move away.
- Do not count towards the natural mob cap, allowing new monsters to continuously spawn and join the permanent horde.
- Constantly consume server CPU ticks calculating pathfinding, line-of-sight, and collisions, slowly dragging down TPS and causing massive entity lag over long-term survival worlds.
Mob Despawn Fix dynamically overrides this persistence, allowing mobs that hoard junk items to despawn naturally like ordinary monsters, without putting player equipment, named mobs, or farms at risk.
Features
- Natural Despawning: Hostile mobs picking up ground items remain subject to standard vanilla despawn distances (despawning naturally when players move 32–128+ blocks away) instead of becoming permanently persistent.
- Safe by Default (Whitelist Mode): Configured with
mode: whitelist out of the box. Only natural cave debris and mob drops (rotten_flesh, bone, arrow, egg, string, spider_eye, gunpowder, gravel, dirt, torch, etc.) allow despawning.
- Player Gear Protection: If a player dies in a cave and a monster picks up their Diamond/Netherite gear, tools, or valuables, the monster retains full vanilla persistence so the player can return and recover their items.
- Name Tag & Farm Safeguards: Any monster given a custom name via a Name Tag, or holding an item renamed in an anvil, is strictly preserved.
- Vehicle Protection: Mobs contained inside boats, minecarts, or any vehicle are protected from despawning (ideal for iron farms, trading halls, and mob cages).
- Retroactive Cave Cleanup: When added to established worlds where hundreds of mobs are already hoarding in caves, the plugin scans loaded chunks and cleanses pre-existing persistence from un-named hoarders.
- Live In-Game Diagnostics: Includes built-in scanning tools (
/mdf info) to diagnose hoarded mobs in loaded chunks, and a manual purge command (/mdf purge).
Commands & Permissions
All commands support the primary /mobdespawnfix command as well as the /mdf and /ddespawn aliases.
| Command |
Description |
Permission |
/mdf info |
Scans loaded chunks and reports total monsters, persistent mobs, and hoarders. |
mobdespawnfix.use |
/mdf purge |
Manually purges non-protected persistent hoarders across loaded chunks. |
mobdespawnfix.use |
/mdf reload |
Reloads config.yml and updates whitelist/blacklist definitions on the fly. |
mobdespawnfix.use |
Configuration
# Mode can be 'whitelist' (only listed items allow despawn) or 'blacklist' (all items allow despawn except listed ones)
mode: whitelist
# Items mobs pick up that will allow them to despawn (used when mode: whitelist)
whitelist:
- rotten_flesh
- bone
- arrow
- string
- spider_eye
- gunpowder
- slime_ball
- glow_ink_sac
- ink_sac
- ender_pearl
- egg
- feather
- raw_chicken
- gravel
- flint
- dirt
- cobblestone
- stone
- torch
- redstone_torch
- coal
- raw_copper
- raw_iron
- kelp
- seagrass
# Items mobs pick up that will NEVER despawn (used when mode: blacklist)
blacklist:
- diamond
- diamond_sword
- diamond_helmet
- diamond_chestplate
- diamond_leggings
- diamond_boots
- netherite_ingot
- netherite_sword
- netherite_helmet
- netherite_chestplate
- netherite_leggings
- netherite_boots
- totem_of_undying
- elytra
# Despawn mobs in vehicles (boats, minecarts, etc.)
despawn-vehicle: false
# Despawn existing mobs that were marked persistent via holding items
retroactive-despawn-check: false
prevent-pickup-persistence: true
ignore-named-mobs: true
ignore-named-items: true
Why was this made?
6 years ago, I made a post on r/Minecraft:
/effect give @e[nbt= {PersistenceRequired:1b}] minecraft:glowing
This returned around 600 targets somehow, and showed a bunch of underground mobs that never despawned either. This is starting to make my world lag and I'm wondering why it's happening.
For years, survival worlds and servers have suffered from this exact mechanic—zombies hoarding chicken eggs, chicken jockey drops, and stray arrows in unlit caves below bases.
While the original Let Me Despawn mod tackled this on Forge/Fabric, the Paper/Spigot plugin version had not received any updates in over 4 years. We created this modern clean-room implementation to solve the problem for modern servers with clean code, safe defaults, and zero bloat.
❤️ Credits
评论 0
登录后参与评分
还没有评论,来抢沙发吧