FrozenVillagers 在不改变村民玩法的前提下减少村民卡顿。 它会找出那些 AI(人工智能)没有执行任何有用操作的村民,降低它们的运行频率,同时保持交易、补货和升级功能以原版方式正常运行。
为什么需要它
在繁忙的生存服务器中,村民往往是占用性能最高的实体。大部分性能消耗花在两件事上:
- 寻找他们无法获取的床、职业和工作铃铛。 一个没有这些资源的村民会每隔 1 到 2 秒就寻找一次,永不停歇。在繁殖箱或拥挤的村庄里,几乎每次搜索都会失败。
- 那些无法移动的村民的“大脑”,例如被锁在交易室隔间里的村民。
直接关闭 AI 虽然能解决性能问题,但会破坏游戏体验:村民将停止补货和升级,如果冻结了错误的村民,铁傀儡农场将不再生产铁傀儡,繁殖箱也会停止繁殖。FrozenVillagers 仅针对那些不需要其 AI 运作的村民进行处理。
它是做什么的
|
适用对象 |
变化内容 |
| 被困村民 |
被锁在 1x1 的隔间或载具中,拥有职业,至少交易过一次,且没有床 |
视觉上无变化:反正他们也无法移动 |
| 多余村民 |
没有职业且没有床的村民,聚集在一起 |
他们会短促地移动 |
| 员工冻结 |
管理员通过 /fv freeze 选择的任何村民 |
他们将静止不动 |
| 出生限制(默认关闭) |
周围有多余村民的繁殖箱 |
直到多余数量下降前,不会生成新宝宝 |
对于插件处理的每一个村民:
- 交易 照常进行,价格、折扣和声望保持不变
- 补货 发生在一天中的固定时间(默认为 07:00、12:00 和 17:00),当玩家打开交易界面时触发
- 升级 按照原版方式进行,并解锁新的交易选项
- 重力、水流、伤害、僵尸转化及治愈效果均正常工作
- 如果村民受伤、附近发生袭击,或者附近放置了床或工作站,它将立即恢复完整的 AI
它绝不会做以下事情:
- 使村民无敌,或让村民对僵尸隐身
- 移除村民
- 自动处理铁傀儡农场、村庄、婴儿、从未交易过的村民(以便重新掷骰子)、NPC,或其他插件修改过的村民
效果
在 Paper 26.2 上测量,整个 Minecraft 一天的平均刻时间(tick time):
| 1,146 名村民,类似于繁忙的生存服务器 |
MSPT(每刻毫秒数) |
| 未安装插件 |
50.7 ms |
| FrozenVillagers,默认配置 |
18.6 ms (-63%) |
| 由员工冻结的交易室 |
13.4 ms (-74%) |
压力测试:4,000 名村民,且有玩家在线:
|
MSPT |
TPS |
| 无优化 |
208 ms |
4.8 |
| FrozenVillagers,自动模式 |
88 ms |
11.3 |
| 加上由员工冻结的自由村民 |
33 ms |
20 |
| 所有村民均由员工冻结 |
7.2 ms |
20 |
插件本身每刻消耗约 0.1 到 0.25 ms。你可以使用 /fv status 查看实时数据。
命令
所有命令都需要 frozenvillagers.admin 权限(默认 OP 可用)。
| 命令 |
功能 |
/fv freeze [radius|selector] |
冻结村民 |
/fv unfreeze [radius|selector] |
恢复他们的 AI,并将其从自动功能中排除 |
/fv auto [radius|selector] |
将其重新设为自动模式 |
/fv adopt [radius|selector] |
接管其他优化插件冻结的村民 |
/fv inspect [selector] |
显示插件对某村民的处理方式及原因 |
/fv status |
统计村民数量并显示插件自身的性能开销 |
/fv reload |
重载配置文件 |
配置
默认设置开箱即用。你最可能更改的选项如下:
| 选项 |
默认值 |
功能 |
restock.times |
[1000, 6000, 11000] |
补货窗口时间段:07:00、12:00 和 17:00 |
restock.mode |
reset-uses |
reset-uses 保持价格不变,vanilla 允许需求推高价格 |
restock.require-workstation |
false |
仅补货那些工作站仍位于其旁边的村民 |
surplus.crowd |
12 |
多少名没有职业且没有床的村民算作“拥挤” |
births.enabled |
false |
当繁殖箱周围多余村民过多时,停止繁殖 |
freeze.disable-physics |
false |
也关闭由员工冻结的村民的物理效果 |
migration.adopt-other-optimizers |
false |
加载时接管来自 BubbleVillagers 等类似插件的村民 |
worlds |
[] |
自动功能适用的世界,空列表表示所有世界 |
完整的 config.yml
# FrozenVillagers. 每个选项都在 README 中有解释。
# 自动优化运行的世界。空列表表示所有世界。
# 通过 /fv freeze 由员工冻结的村民在任何地方都保持冻结状态。
worlds: []
# 每个村民再次被检查的频率(以刻为单位)。检查分散在这些刻中进行,因此它们永远不会同时发生。
# 100 = 5 秒。
check-interval: 100
# 用于从 BubbleVillagers、VillagerOptimizer 或 AntiVillagerLag 迁移。
# 设置为 true 时,当区块加载时,这些插件优化的每个村民都会被自动接管,就像执行 /fv adopt 一样。
# 其 AI 被其他插件关闭的村民仍然会被忽略。
# 当 /fv status 显示没有其他插件导致的无 AI 村民时,请将其关闭。
migration:
adopt-other-optimizers: false
# /fv freeze,供员工使用。
freeze:
# 冻结的村民始终关闭其 AI、物品拾取和推力交互。
# 设置为 true 时,它们的物理效果也会关闭:不再掉落或被水推动。
# 这样可以节省更多性能,但仅应用于站在坚实地面以上的村民。
disable-physics: false
# /fv freeze、unfreeze、auto 和 adopt 允许的最大半径。
max-command-radius: 32
# 插件减速的村民会在每 "cycle" 刻中的 "active" 刻内恢复 AI,其余时间关闭 AI。
# 默认值是每 10 秒有 1 秒活跃。
pulse:
cycle: 200
active: 20
无法移动且无处可去的村民,除了他们永远无法到达的床:被锁在 1x1 的格子或载具中,拥有职业,至少交易过一次,但没有床。他们的速度会降低。由于他们无论如何都无法移动,玩家看不出任何区别。
trapped:
enabled: true
多余的村民:没有职业(或笨蛋)的成年村民,一段时间内没有床,与其他许多类似的村民挤在一起。这就是繁殖器旁边堆积的情况。铁傀儡农场中的村民始终有床,因此他们永远不会受到影响。
surplus:
enabled: true
在一个村民周围 3x3 个区块中,需要有多少个没有床和职业的村民才能被视为多余。
crowd: 12
村民在没有床的情况下经过多少刻后才能被视为多余。6000 = 5 分钟。
grace: 6000
关闭多余村民之间的推挤。在大群集中节省计算量,但实体拥挤不再杀死他们,因此群体可以无限增长。
disable-collisions: false
当父母周围有太多多余的村民时,即使它们存储在其他区块中,也会停止繁殖。永远不会移除任何村民。
births:
enabled: false
在“半径”方块范围内允许的父母周围的没有床和职业的村民(包括婴儿),超过此数量后婴儿将停止出生。
max-surplus: 24
radius: 64
被插件冻结或减速的村民无法走到工作站,因此当玩家打开交易窗口时,他们会在以下时间范围内重新补货。白天时间:0 = 06:00, 1000 = 07:00, 6000 = 12:00, 11000 = 17:00。
restock:
enabled: true
times: [1000, 6000, 11000]
reset-uses:交易被重置,价格不会因需求而上涨。
vanilla:原版补货机制,频繁使用的交易价格会略微上涨。
mode: reset-uses
仅补货那些工作站仍然存在且靠近村民的村民。
require-workstation: false
从村民脚部到其工作站的距离上限(以方块为单位)。
workstation-reach: 2.5
当村民补货时发送给玩家的消息。留空则不发送任何内容。
MiniMessage 格式,%next% 是距离下次补货的时间。
message: ""
更改配置后运行 /fv reload。错误的值会在控制台中报告并被默认值替换。
从 BubbleVillagers 或 VillagerOptimizer 切换
安装 FrozenVillagers,运行 /fv adopt(或者开启 migration.adopt-other-optimizers 以便在区块加载时接管村民),然后移除旧插件。已在 4,000 名村民的环境中测试。请先备份你的世界。完整步骤请参阅 README。
要求
每个选项、功能的工作原理及其测试方法均位于 README 中。
FrozenVillagers cuts villager lag without changing how villagers play. It finds the villagers whose AI isn't doing anything useful, slows them down, and keeps trading, restocks and level ups working the vanilla way.
Why
On a busy survival server villagers are often the most expensive entities. Most of that time goes into two things:
- Searching for beds, jobs and bells they can't get. A villager without one looks for it every 1 to 2 seconds, forever. In a breeder's storage or a crowded village almost every search fails.
- The brain of villagers that can't move, like the ones locked in trading hall cells.
Turning the AI off fixes the cost but breaks the game: villagers stop restocking and levelling up, and if the wrong ones are frozen, iron farms stop making golems and breeders stop breeding. FrozenVillagers only touches the villagers that don't need their AI.
What it does
|
Who |
What changes |
| Trapped villagers |
Locked in a 1x1 cell or a vehicle, with a job, traded at least once, no bed |
Nothing visible: they couldn't move anyway |
| Surplus villagers |
Jobless villagers without a bed, packed in a crowd |
They move in short bursts |
| Staff freeze |
Any villager staff picks with /fv freeze |
It stands still |
| Birth limit (off by default) |
Breeders with too much surplus around them |
No new babies until it goes down |
For every villager the plugin handles:
- trading works as usual, with the same prices, discounts and reputation
- restocks happen at fixed times of day (07:00, 12:00 and 17:00 by default) when a player opens the trades
- level ups happen the vanilla way, with the new trades
- gravity, water, damage, zombie conversion and curing keep working
- a hurt villager, a raid nearby, or a bed or workstation placed nearby gives it its full AI back right away
What it never does:
- make villagers invincible, or hide them from zombies
- remove a villager
- touch, on its own, iron farms, villages, babies, villagers that never traded (so rerolling works), NPCs, or villagers another plugin changed
Results
Measured on Paper 26.2, average tick time over a full Minecraft day:
| 1,146 villagers, like a busy survival server |
MSPT |
| Without the plugin |
50.7 ms |
| FrozenVillagers, default config |
18.6 ms (-63%) |
| Trading halls frozen by staff |
13.4 ms (-74%) |
Stress test with 4,000 villagers and a player online:
|
MSPT |
TPS |
| Without optimizations |
208 ms |
4.8 |
| FrozenVillagers, automatic |
88 ms |
11.3 |
| Plus the free villagers frozen by staff |
33 ms |
20 |
| Everything frozen by staff |
7.2 ms |
20 |
The plugin itself costs about 0.1 to 0.25 ms per tick. /fv status shows it live.
Commands
All commands need frozenvillagers.admin (op by default).
| Command |
What it does |
/fv freeze [radius|selector] |
Freezes villagers |
/fv unfreeze [radius|selector] |
Gives them their AI back and excludes them from the automatic features |
/fv auto [radius|selector] |
Puts them back to automatic |
/fv adopt [radius|selector] |
Takes over villagers another optimizer plugin froze |
/fv inspect [selector] |
Shows what the plugin does with a villager and why |
/fv status |
Counts the villagers and shows the plugin's own cost |
/fv reload |
Reloads the config |
Configuration
The defaults work out of the box. The options you are most likely to change:
| Option |
Default |
What it does |
restock.times |
[1000, 6000, 11000] |
Restock windows in day time: 07:00, 12:00 and 17:00 |
restock.mode |
reset-uses |
reset-uses keeps prices as they are, vanilla lets demand raise them |
restock.require-workstation |
false |
Only restock villagers whose workstation is still next to them |
surplus.crowd |
12 |
How many jobless villagers without a bed make a crowd |
births.enabled |
false |
Stop breeding when there is too much surplus around the breeder |
freeze.disable-physics |
false |
Also turn off physics for villagers frozen by staff |
migration.adopt-other-optimizers |
false |
Adopt villagers from BubbleVillagers and similar plugins as they load |
worlds |
[] |
Worlds for the automatic features, empty means all |
The full config.yml
# FrozenVillagers. Every option is explained in the README.
# Worlds where the automatic optimizations run. An empty list means all
# worlds. Villagers frozen by staff with /fv freeze stay frozen everywhere.
worlds: []
# How often, in ticks, each villager is checked again. The checks are spread
# over these ticks, so they never all happen at once. 100 = 5 seconds.
check-interval: 100
# For switching from BubbleVillagers, VillagerOptimizer or AntiVillagerLag.
# With true, every villager those plugins optimized is adopted on its own
# when its chunk loads, like /fv adopt does. Villagers whose AI any other
# plugin turned off are still left alone. Turn it off again once
# /fv status shows no villagers without AI because of another plugin.
migration:
adopt-other-optimizers: false
# /fv freeze, for staff.
freeze:
# Frozen villagers always have their AI, item pickup and pushing turned
# off. With true their physics are off too: they no longer fall or get
# pushed by water. Saves a bit more, but only use it for villagers that
# stand on solid ground.
disable-physics: false
# The largest radius allowed in /fv freeze, unfreeze, auto and adopt.
max-command-radius: 32
# Villagers the plugin slows down get their AI back for "active" ticks
# every "cycle" ticks, and have it off the rest of the time. The default is
# 1 second every 10 seconds.
pulse:
cycle: 200
active: 20
# Villagers that can't move and have nothing to look for, except a bed they
# can never reach: locked in a 1x1 cell or in a vehicle, with a profession,
# traded at least once, without a bed. They are slowed down. Since they
# can't move anyway, players don't see any difference.
trapped:
enabled: true
# Surplus villagers: adults with no profession (or nitwits) that have had no
# bed for a while, packed together with many others like them. This is what
# piles up next to a breeder. They are slowed down until they find a bed or
# a job, or the crowd shrinks. Iron farm villagers always have a bed, so they
# are never touched.
surplus:
enabled: true
# How many villagers without a bed and a job there must be in the 3x3
# chunks around a villager for it to count as surplus.
crowd: 12
# Ticks without a bed before a villager can count as surplus. 6000 = 5 minutes.
grace: 6000
# Turn off pushing between surplus villagers. Saves work in big crowds, but
# entity cramming no longer kills them, so a crowd can grow without limit.
disable-collisions: false
# Stops breeding when there is too much surplus around the parents, even if
# it is stored in other chunks. No villager is ever removed.
births:
enabled: false
# Villagers without a bed and a job (babies included) allowed within
# "radius" blocks of the parents before babies stop being born.
max-surplus: 24
radius: 64
# Villagers frozen or slowed down by the plugin can't walk to their
# workstation, so they restock when a player opens their trades, once per
# window below. Day times: 0 = 06:00, 1000 = 07:00, 6000 = 12:00, 11000 = 17:00.
restock:
enabled: true
times: [1000, 6000, 11000]
# reset-uses: trades are refilled and prices don't go up with demand.
# vanilla: the vanilla restock, prices go up a bit for trades used a lot.
mode: reset-uses
# Only restock villagers whose workstation is still there and close to them.
require-workstation: false
# Max distance in blocks from the villager's feet to its workstation.
workstation-reach: 2.5
# Sent to the player when a villager restocks. Empty sends nothing.
# MiniMessage format, %next% is the time until the next restock.
message: ""
Run /fv reload after changing it. Bad values are reported in the console and replaced by the defaults.
Switching from BubbleVillagers or VillagerOptimizer
Install FrozenVillagers, run /fv adopt (or turn on migration.adopt-other-optimizers to adopt villagers as their chunks load), then remove the old plugin. Tested with 4,000 villagers. Back up your world first. The full steps are in the README.
Requirements
Every option, how each feature works and how it was tested are in the README.
评论 0
登录后参与评分
还没有评论,来抢沙发吧