-
Notifications
You must be signed in to change notification settings - Fork 0
Mob Scaling
Hostile mobs gain levels based on distance from spawn, biome, nearby structures, and how many players are nearby. A mob's level scales its health, attack damage, armor, and movement speed, and shows in its name (&cLv. {level} {name} by default).
Use /rpgmood info in-game to see the zone and mob levels at your current location — the fastest way to sanity-check your tuning.
Every mob spawn (CreatureSpawnEvent, except SpawnReason.CUSTOM) is checked against mob_scaling.enabled and mob_scaling.hostile-only:
-
hostile-only: true(default) — only mobs that are aMonster(zombies, skeletons, spiders, creepers, endermen, etc.) get scaled -
hostile-only: false— all living entities get scaled, including passive mobs
A mob is scaled at most once — a scoreboard tag (rpgmood_scaled) marks it as already processed.
radialLevel = floor(distanceFromSpawn / step_distance)
adjustedBase = max(0, baseLevel - 2)
total = adjustedBase
+ max(0, radialLevel - 1)
+ biomeBonus
+ structureBonus
+ nearbyPlayers * players_bonus_per_player
level = clamp(total, 1, max-level)
-
baseLevel— frommob_scaling.base-levels.<ENTITY_TYPE>(default1for unlisted types). This is a difficulty seed per mob type — e.g.ZOMBIE: 1,WITHER_SKELETON: 5— not the mob's actual displayed level. -
radialLevel— how manystep_distanceblocks (default180) the mob is from world spawn. The first step doesn't add a level (onlyradialLevel - 1counts), so mobs right around spawn stay near the floor. -
biomeBonus— frommob_scaling.biome-bonuses.<BIOME>(default0). -
structureBonus— frommob_scaling.structure-bonuses.<structure_key>if the mob is near a matching vanilla structure (see below). -
nearbyPlayers— count of players within ~30 blocks (900 blocks²) of the mob, each contributingplayers_bonus_per_player(default1). This means grinding spots with several players standing close together will push mob levels up — by design, but worth knowing before you build a shared farm near spawn. - The result is always clamped between
1andmax-level(default40).
structure-bonuses keys (e.g. stronghold, desert_pyramid, woodland_mansion, ocean_monument, nether_fortress) are vanilla structure names. When a mob spawns, RPGMood checks whether it's near any configured structure using Bukkit's locateNearestStructure — one of the more expensive calls in the API.
To keep this cheap at scale, results are cached per 128×128-block grid cell (capped at 4096 cached cells, LRU-evicted). The first mob to spawn in a given cell pays the lookup cost; every subsequent mob in that same cell reuses the cached bonus. Since vanilla structures don't move once generated, this cache never needs to be invalidated.
Given a resolved level, applied via Bukkit attributes:
| Attribute | Formula | Floor |
|---|---|---|
| Max Health | 14.0 + (level - 1) * health_per_level |
10.0 |
| Attack Damage | 0.6 + (level - 1) * damage_per_level |
0.4 |
| Armor | (level - 1) * armor_per_level |
0.0 |
| Movement Speed | base speed + (level - 1) * speed_per_level
|
0.01 |
Defaults: health_per_level: 2.0, damage_per_level: 0.12, armor_per_level: 0.25, speed_per_level: 0.0015.