情绪传染
生物现在携带一种隐藏的情绪状态:平静(CALM)、恐慌(PANIC)或暴怒(RAGE)。战斗会触发该状态,它会在同种生物之间向附近传播,并随时间逐渐恢复为平静。
- 攻击一只生物会使其陷入恐慌。它会逃离你,恐惧会扩散到附近的同类:一只受惊的羊就能引发整个羊群的恐慌。
- 攻击狼、蜜蜂或任何敌对生物会使它们进入暴怒状态。暴怒的生物移动更快、攻击力更强,且中立动物会转身向你发起攻击。暴怒状态的传播方式相同。
- 击杀一只生物会导致附近同种生物陷入恐慌。
处于恐慌状态的生灵会散发出黄色粒子,而处于暴怒状态的生灵则散发红色粒子,让你能一目了然地读取其状态。
工作原理
- 每个生物的状态及时间戳都存储在其
PersistentDataContainer 中,因此情绪状态在区块卸载和重启后得以保留,且不会造成内存泄漏。
- 一个任务每秒运行约一次,以每刻预算轮询处理生物,因此无论世界多么拥挤,该功能对 TPS 的影响始终保持低廉。
- 带有情绪的有一定几率感染半径内的同种邻居。情绪会在可配置的时间后衰减回平静。
- PANIC 赋予速度并使生物逃离最近的玩家。RAGE 赋予速度和力量,并使中立生物锁定最近的玩家为目标。
命令
| 命令 |
描述 |
权限 |
/moodcontagion info |
显示当前的可调参数。 |
moodcontagion.use (默认: 所有人) |
/moodcontagion here |
统计你周围 16 格内处于 CALM/PANIC/RAGE 状态的生物数量。 |
moodcontagion.admin (默认: OP) |
/moodcontagion reload |
重新加载 config.yml。 |
moodcontagion.admin (默认: OP) |
别名:/mood, /contagion。
权限
| 节点 |
默认值 |
授予 |
moodcontagion.use |
everyone |
info 和 here 子命令 |
moodcontagion.admin |
OP |
reload (包含 moodcontagion.use) |
配置 (config.yml)
| 键 |
默认值 |
含义 |
spread-radius |
8.0 |
情绪传播给同种生物的方块距离(也是逃离/重新锁定的扫描范围,x2)。 |
spread-chance |
0.35 |
每个邻居每秒感染同种邻居的概率。 |
decay-seconds |
12 |
情绪状态持续多久后衰减为 CALM。 |
max-processed-per-tick |
40 |
TPS 保护:每次处理循环最多处理的生物数量(轮询制)。 |
panic-flee-speed |
0.45 |
PANIC 生物被推开远离最近玩家的力度。 |
max-horizontal-velocity |
1.5 |
插件设置的速度硬上限(防击飞安全限制)。 |
death-seed-radius |
8 |
死亡生物周围的方块范围,在此范围内的同种生物会被种子化为 PANIC 状态。 |
effects.enabled |
true |
所有药水效果的主开关。 |
effects.speed |
true |
PANIC 和 RAGE 生物获得速度效果。 |
effects.strength |
true |
RAGE 生物获得力量效果。 |
effects.rage-retarget |
true |
暴怒的中立生物锁定最近的玩家(仅当它们没有有效目标时)。 |
effects.particles |
true |
情绪生物上方出现对应情绪颜色的粒子爆发。 |
所有值在加载时都会被限制在安全范围内。
兼容性
Paper, Spigot, Bukkit 和 Purpur 1.21.1 至 1.21.11 以及 26.1.x 系列(已在 26.1.2 上验证),Java 21。基于 Spigot API 构建,不包含任何仅 Paper 类,因此单个 jar 包可在所有四种服务器类型上运行。
原始概念,内部测试想法。并非源自 Reddit 帖子。
Mood Contagion
Mobs now carry a hidden emotional state: CALM, PANIC, or RAGE. Combat seeds the state, it spreads
to nearby mobs of the same type, and it fades back to calm over time.
- Hit a mob and it panics. It runs from you, and the fear spreads to others nearby: one scared
sheep can set off the whole flock.
- Hit a wolf, a bee, or any hostile and it rages instead. Raging mobs move faster and hit harder,
and a neutral animal will turn and come for you. Rage spreads the same way.
- Kill a mob and nearby mobs of the same type panic.
Panicking mobs give off yellow particles and enraged mobs give off red ones, so you can read the
state at a glance.
How it works
- Each mob's state and a timestamp are stored on the mob in its
PersistentDataContainer, so moods
survive chunk unloads and restarts and never leak memory.
- A task runs about once a second and processes mobs round-robin with a per-tick budget, so the
feature stays cheap on TPS no matter how crowded the world is.
- Emotional mobs have a chance to infect same-type neighbours within a radius. Moods decay back to
calm after a configurable time.
- PANIC adds Speed and makes the mob flee the nearest player. RAGE adds Speed and Strength, and
makes neutral mobs target the nearest player.
Commands
| Command |
Description |
Permission |
/moodcontagion info |
Show the current tunables. |
moodcontagion.use (default: all) |
/moodcontagion here |
Count CALM/PANIC/RAGE mobs within 16 blocks of you. |
moodcontagion.admin (default: OP) |
/moodcontagion reload |
Reload config.yml. |
moodcontagion.admin (default: OP) |
Aliases: /mood, /contagion.
Permissions
| Node |
Default |
Grants |
moodcontagion.use |
everyone |
the info and here sub-commands |
moodcontagion.admin |
OP |
reload (and includes moodcontagion.use) |
Configuration (config.yml)
| Key |
Default |
Meaning |
spread-radius |
8.0 |
Blocks within which a mood spreads to same-type mobs (also the flee/retarget scan range, x2). |
spread-chance |
0.35 |
Per-neighbour, per-second chance to infect a same-type neighbour. |
decay-seconds |
12 |
How long an emotional mood lasts before it decays to CALM. |
max-processed-per-tick |
40 |
TPS guard: max mobs handled per processing pass (round-robin). |
panic-flee-speed |
0.45 |
How hard a PANIC mob is shoved away from the nearest player. |
max-horizontal-velocity |
1.5 |
Hard cap on any velocity the plugin sets (anti-launch safety). |
death-seed-radius |
8 |
Blocks around a dying mob in which same-type mobs are seeded PANIC. |
effects.enabled |
true |
Master switch for all potion effects. |
effects.speed |
true |
PANIC and RAGE mobs gain Speed. |
effects.strength |
true |
RAGE mobs gain Strength. |
effects.rage-retarget |
true |
Neutral RAGE mobs target the nearest player (only when they have no valid target). |
effects.particles |
true |
Mood-coloured particle puffs above emotional mobs. |
All values are clamped to safe ranges on load.
Compatibility
Paper, Spigot, Bukkit, and Purpur 1.21.1 to 1.21.11 and the 26.1.x line (verified on 26.1.2),
Java 21. Built against the Spigot API with no Paper-only classes, so the single jar works on all
four server types.
Original concept, an internal test idea. Not sourced from a Reddit post.
评论 0
登录后参与评分
还没有评论,来抢沙发吧