Progression - MarkusBordihn/BOs-Easy-NPC GitHub Wiki
The progression system lets NPCs gain XP, level up, and optionally scale attributes with their level.

Current progression limits in the code:
- minimum level:
1 - maximum level:
60 - default progression data: level
1, XP1, attribute scaling disabled
XP changes automatically recalculate the level. Level changes can also trigger optional attribute scaling.
/easy_npc progression get <NPC>
/easy_npc progression set <NPC> level <1-60>
/easy_npc progression set <NPC> xp <xp>
/easy_npc progression add <NPC> xp <xp>
/easy_npc progression scaling <NPC> <true|false>Notes:
-
set xpaccepts values starting at1 -
add xpaccepts positive and negative values - XP is clamped internally to the supported progression range
Get progression data from an Easy NPC:
ProgressionDataCapable<?> progression = easyNPC.getEasyNPCProgressionData();
if (progression != null) {
int level = progression.getExperienceLevel();
int xp = progression.getExperience();
}Useful methods:
progression.setExperience(250);
progression.addExperience(50);
progression.setExperienceLevel(10);
progression.setAttributeScalingEnabled(true);Progress helpers:
int currentLevel = progression.getExperienceLevel();
int currentXp = progression.getExperience();
int nextLevelXp = progression.getExperienceForNextLevel();
int progressXp = progression.getExperienceProgressToNextLevel();
float progressPercent = progression.getProgressPercentageToNextLevel();
boolean maxLevel = progression.isMaxExperienceLevel();ProgressionDataCapable provides these callbacks:
onProgressLevelUp(ProgressionData oldData, ProgressionData newData)onProgressLevelDown(ProgressionData oldData, ProgressionData newData)onProgressLevelChange(ProgressionData oldData, ProgressionData newData)
onProgressLevelChange(...) is the central callback and applies level-based attribute scaling after
the level change.
The current XP table is generated from:
if (level <= 1) {
return 1;
}
return (int) (Math.pow(level, 2.5) + (level * 10));Examples from the current table:
| Level | XP for level |
|---|---|
| 1 | 1 |
| 2 | 14 |
| 5 | 105 |
| 10 | 416 |
| 20 | 1988 |
| 40 | 10519 |
| 60 | 28485 |
If attribute scaling is enabled, the current implementation reapplies level-based scaling whenever the progression state changes.
You can also use the built-in helper for your own scaling logic:
int adjustment = progression.getAttributeAdjustment(baseValue, maxValue);This calculates a linear adjustment based on the current level and the configured max level.
Progression data is synchronized through synched entity data and stored in NBT through
ProgressionData.
The current record shape is:
public record ProgressionData(
int experience,
int experienceLevel,
boolean attributeScalingEnabled) {}- Progression does not award XP automatically. Your code or commands must change XP explicitly.
- Setting XP can level an NPC up or down.
- Level and XP are linked through
ProgressionLevelMap.
See also: