Auto Leveling

Auto Leveling

6M Downloads

Overrides experience changes from other mods

SiverDX opened this issue ยท 0 comments

commented

Example: Experience attribute from Apotheosis (ancient knowledge potion / charm, affixes, etc.)
In general everything with a higher event priority

https://github.com/Shadows-of-Fire/Apotheosis/blob/2024ba9698dbd0fe20e104b05788aed451388368/src/main/java/shadows/apotheosis/core/attributeslib/impl/AttributeEvents.java#L236-L242

@SubscribeEvent
public static void adjustExpirienceDrop(LivingExperienceDropEvent event) {
if (!hasLevel(event.getEntity())) return;
var level = getLevel(event.getEntity()) + 1;
var originalExp = event.getOriginalExperience();
var expBonus = Config.COMMON.expBonus.get() * level;
event.setDroppedExperience((int) (originalExp + originalExp * expBonus));
}