For developers
Reading progression state and reacting to its events from an addon.
RPG Progression exposes a small, stable API surface intended for addon mods (such as the other Verox' RPG mods or third-party content packs). Depend on verox_rpg_prog as a normal mod dependency, but only reference the classes below - internal classes such as StageManager may change between versions without notice.
Reading progression state
import net.veroxuniverse.verox_rpg_prog.api.ProgressionApi;
int order = ProgressionApi.getUnlockedOrder();
boolean locked = ProgressionApi.isItemLocked(ResourceLocation.parse("minecraft:diamond_sword"));
Optional<StageDefinition> current = ProgressionApi.getCurrentStage();Available methods: getUnlockedOrder(), getAllStages(), getStageByOrder(int), getCurrentStage(), isItemLocked(ResourceLocation), isBlockLocked(ResourceLocation), isOreLocked(ResourceLocation), isDimensionLocked(ResourceLocation), isBossLocked(ResourceLocation), getOwningStageForBoss(ResourceLocation), getBossInfo(ResourceLocation), isRegisteredBoss(ResourceLocation).
Reacting to progression events
Two events are posted on NeoForge.EVENT_BUS, both in net.veroxuniverse.verox_rpg_prog.api.event:
StageUnlockedEvent - fired whenever the world's stage order changes, including manual changes via /rpg_prog stage set or reset. Not cancellable; the change has already happened.
@SubscribeEvent
public static void onStageUnlocked(StageUnlockedEvent event) {
event.getNewStage().ifPresent(stage -> {
// e.g. spawn addon-specific content for this stage
});
}BossDefeatedEvent - fired when a registered boss (main or optional, from any loaded stage) is killed by a player, after RPG Progression has advanced the world stage (if it was the next main boss) and before the boss's drops are spawned. Intended for addons that want to react to a boss kill independently, for example granting achievements or spawning follow-up content.
@SubscribeEvent
public static void onBossDefeated(BossDefeatedEvent event) {
if (event.wasMainBoss()) {
// react to the main boss of event.getOwningStage() being defeated
}
}What addons should not do
- Do not write to
StageManager's internal maps directly, even though the class is technically public - always go through the events above to react, and never assume its internal structure will stay the same between versions. - Do not assume a stage's
ordervalues are contiguous or start at0- always compare relatively (>=,>), never hardcode an expected sequence. - Do not rely on
player_scaling,mob_attribute_scalingor territorymob_scalingupdating dynamically after a mob has already spawned - all of them are spawn-time only.
