Skip to content

Mob Scaling

okereke-dev edited this page Jul 4, 2026 · 6 revisions

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.


What triggers scaling

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 a Monster (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.


The level formula

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 — from mob_scaling.base-levels.<ENTITY_TYPE> (default 1 for 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 many step_distance blocks (default 180) the mob is from world spawn. The first step doesn't add a level (only radialLevel - 1 counts), so mobs right around spawn stay near the floor.
  • biomeBonus — from mob_scaling.biome-bonuses.<BIOME> (default 0).
  • structureBonus — from mob_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 contributing players_bonus_per_player (default 1). 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 1 and max-level (default 40).

Structure bonus and performance

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.


Stat scaling

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.

Clone this wiki locally