无需卡顿的村民交易大厅——且不破坏交易机制。
全自动。无需名牌、特殊方块或玩家需学习的指令。免费,无依赖,无遥测数据收集。
为什么交易大厅会卡顿
被锁在 1×1 格子里的村民无法移动。但它的“大脑”并不知道这一点。每个游戏刻(tick),它都会寻找路径、床、工作站点、集会点以及其他村民以进行闲聊。一个拥有 200 名村民的大厅会让服务器忙于做毫无意义的无用功。
VillagerWarden 做了什么
它会暂停被困住村民的“大脑”,并根据原版规则代为执行其工作:
- 补货按照原版村民的方式进行:在其工作站点、工作时间内、每天最多两次、且间隔至少 2400 刻。需求和价格的更新完全通过服务器自身的补货机制与原版一致——因此热门交易仍会变贵。所谓“优化”后的村民不会变成廉价交易的无尽来源。
- 交易唤醒村民。 当你进行交易时,以及之后的三秒内,其“大脑”正常运行:它会注视你,游戏本身也会提升其等级、解锁新交易,并将每次交易计入你的声望。没有任何功能被重新实现,因此绝不会偏离原版行为。
在测试服务器上测得的数据 —— 200 名村民处于 1×1 格子中,模拟玩家站在大厅里的活跃状态,两种情况各运行两个交替的 60 秒周期:
|
平均刻耗时 |
| 大脑运行中 |
8.6 ms |
| 大脑暂停中 |
0.9 ms |
这节省了 90% 的刻耗时。村民是游戏中最消耗性能的实体——每个刻约占用 40 µs。
自动暂停哪些村民
仅当满足以下条件时才会暂停村民:
- 拥有职业并至少交易过一次。从未交易过的村民保留其“大脑”,这样你仍可通过破坏和重建工作站点来重置其交易;
- 被困住:坐在矿车或船里,或者步行只能到达少数几个方块。检测方式遵循原版寻路逻辑——向上走一格,向下掉落最多三格;
- 旁边有工作站点。失去工作站的村民会保留其“大脑”,直到认领新的工作站;
- 没有床。铁傀儡农场和繁殖场需要村民的“大脑”,因此它们永远不会被处理;
- 成年、清醒且不在水中。
打破格子墙壁后,村民会在下一个刻醒来。将其放回原处后,它会被再次暂停。
玩家可以查看任意村民并运行 /villagerwarden check 命令,以了解其是否已被优化,如果未优化,具体原因是什么。
当自动化判断出错时
并非所有自定义建筑都符合自动规则。管理员可以为其周围的村民进行覆盖:
/villagerwarden optimize <radius> - 始终暂停这些村民,即使它们未被困住。睡眠中的村民、婴儿和水中的村民仍会被忽略。
/villagerwarden exclude <radius> - 永远不要处理这些村民。
/villagerwarden auto <radius> - 恢复自动模式。
选择结果会保存在村民身上,重启后依然有效。从控制台或命令方块添加世界和坐标:/villagerwarden exclude 5 world 120 64 -40。
不会在你的世界中留下痕迹
暂停实体的“大脑”会存储在其存档数据中。常见的做法是关闭村民的 AI 并保持该状态——这意味着一旦移除插件,你的大厅将永远冻结。VillagerWarden 会在区块卸载前和服务器停止时归还每位村民的“大脑”,并在加载时再次暂停它们。
已验证: 停止服务器,移除插件,重新启动——每位村民都是正常的村民,等级、交易和工作站点完好无损。
由其他插件(NPC)冻结的村民永远不会被触碰——VillagerWarden 只会释放自己暂停过的村民。
命令
| 命令 |
权限 |
作用 |
/villagerwarden check |
villagerwarden.check (所有人) |
检查你所看的村民是否已优化,若未优化则说明原因 |
/villagerwarden status |
villagerwarden.admin |
显示已优化的村民数量,以及补货和升级次数 |
/villagerwarden optimize|exclude|auto <radius> |
villagerwarden.admin |
覆盖周围村民的自动选择 |
/villagerwarden release |
villagerwarden.admin |
释放所有村民并取消暂停——用于移除插件前 |
/villagerwarden reload |
villagerwarden.admin |
应用配置更改 |
别名 /vw。
配置
enabled: true
# 运行的世界。空 = 所有世界。
worlds: []
# 能到达此数量方块或更少的村民被视为被困住。
max-cell-size: 6
check-interval-seconds: 10
# 根据原版规则为暂停的村民补货。
restock: true
# 当玩家与该村民交易时及其后三秒内唤醒暂停的村民。
wake-while-trading: true
# 忽略有床的村民——铁傀儡农场和繁殖场需要它们。
skip-villagers-with-beds: true
每条消息均位于配置文件中。英文和俄文 —— 首次启动时 config-ru.yml 会与配置文件并存。
村民暂停期间的变化
关于权衡的诚实说明:
- 它不会睡觉、闲聊或恐慌。治愈或攻击它所产生的声望衰减速度变慢。
- 它不会召唤铁傀儡——这也是为什么有床的村民永远不会被暂停的原因。
要求
- Paper 或 Purpur 1.21.4 - 1.21.11 和 26.1 - 26.2 —— 一个 JAR 包支持所有这些版本
- Java 21 或更高版本
- 无依赖。尚不兼容 Folia。
支持
欢迎提交 Bug 报告,其优先级高于功能请求。提供你的配置文件、/villagerwarden status 输出以及 /villagerwarden check 对目标村民的报告,此类问题修复最快。
Villager trading halls without the lag - and without breaking trading.
Automatic. No name tags, no special blocks, no commands for players to learn. Free, no dependencies, no telemetry.
Why trading halls lag
A villager locked in a 1×1 cell cannot go anywhere. Its brain does not know that. Every tick it looks for paths, beds, job sites, meeting points and other villagers to gossip with. A hall of 200 villagers keeps the server busy doing nothing useful.
What VillagerWarden does
It pauses the brain of villagers that are locked in - and does their work for them by the vanilla rules:
- Restocking happens the way a vanilla villager does it: at its job site, during work hours, at most twice a day, at least 2400 ticks apart. Demand and prices are updated exactly as in vanilla, through the server's own restock - so popular trades still get more expensive. A hall of "optimized" villagers does not become an endless source of cheap deals.
- Trading wakes the villager up. While you trade, and for three seconds after, its brain runs as usual: it looks at you, and the game itself levels it up, unlocks new trades and counts every trade toward your reputation. Nothing is reimplemented, so nothing can drift from vanilla.
Measured on a test server - 200 villagers in 1×1 cells, active as if a player stood in the hall, two alternating 60-second runs each way:
|
Average tick |
| Brains running |
8.6 ms |
| Brains paused |
0.9 ms |
That is 90% of the tick. Villagers are the most expensive mob in the game - about 40 µs each, every tick.
Who gets paused - automatically
Only a villager that:
- has a profession and has traded at least once. Villagers that never traded keep their brain, so you can still reroll their trades by breaking and replacing the job site;
- is locked in: sits in a minecart or boat, or can reach only a few blocks on foot. The check walks the cell the way vanilla pathfinding does - stepping up one block, dropping down up to three;
- has a job site next to it. A villager that lost its workstation keeps its brain until it claims a new one;
- has no bed. Iron golem farms and breeders need their villagers' brains, so they are never touched;
- is an adult, awake and not in water.
Break a wall of the cell and the villager wakes up on the next tick. Put it back and it is paused again.
Players can look at any villager and run /villagerwarden check to see whether it is optimized, and if not, exactly why.
When the automation guesses wrong
No automatic rule fits every custom build. Admins can override it for the villagers around them:
/villagerwarden optimize <radius> - always pause these villagers, even if they are not locked in. Sleeping villagers, babies and villagers in water are still left alone.
/villagerwarden exclude <radius> - never touch these villagers.
/villagerwarden auto <radius> - back to automatic.
The choice is stored on the villager and survives restarts. From the console or a command block, add the world and coordinates: /villagerwarden exclude 5 world 120 64 -40.
Nothing is left in your world
Pausing a mob's brain is stored in its save data. The common approach - switching the villager's AI off and leaving it that way - means that once such a plugin is removed, your hall stays frozen. VillagerWarden gives every villager its brain back before a chunk unloads and when the server stops, and pauses it again when it loads.
Verified: stop the server, remove the plugin, start again - every villager is a normal villager, with its level, trades and job site intact.
Villagers frozen by other plugins (NPCs) are never touched - VillagerWarden only ever releases the ones it paused itself.
Commands
| Command |
Permission |
What it does |
/villagerwarden check |
villagerwarden.check (everyone) |
Is the villager you look at optimized, and if not, why |
/villagerwarden status |
villagerwarden.admin |
How many villagers are optimized, restocks and level-ups done |
/villagerwarden optimize|exclude|auto <radius> |
villagerwarden.admin |
Override the automatic choice for villagers around you |
/villagerwarden release |
villagerwarden.admin |
Release every villager and pause - before removing the plugin |
/villagerwarden reload |
villagerwarden.admin |
Apply config changes |
Alias /vw.
Configuration
enabled: true
# Worlds to work in. Empty = all worlds.
worlds: []
# A villager that can reach this many blocks or fewer counts as locked in.
max-cell-size: 6
check-interval-seconds: 10
# Restock trades for paused villagers by the vanilla rules.
restock: true
# Wake a paused villager while a player trades with it and for three seconds after.
wake-while-trading: true
# Leave villagers with beds alone - golem farms and breeders need them.
skip-villagers-with-beds: true
Every message is in the config. English and Russian - config-ru.yml lands next to your config on first start.
What changes while a villager is paused
Honesty about the trade-offs:
- It does not sleep, gossip or panic. Reputation from curing or hitting it decays more slowly.
- It does not summon iron golems - which is why villagers with beds are never paused.
Requirements
- Paper or Purpur 1.21.4 - 1.21.11 and 26.1 - 26.2 - one jar for all of them
- Java 21 or newer
- No dependencies. Not Folia-compatible yet.
Support
Bug reports are welcome and get priority over feature requests. A report with your config, /villagerwarden status and what /villagerwarden check says about the villager in question gets fixed fastest.
评论 0
登录后参与评分
还没有评论,来抢沙发吧