HammerLib

HammerLib

37M Downloads

org.zeith.hammerlib.util.XPUtil is using experience calculations from Minecraft 1.8

lynnpye opened this issue ยท 0 comments

commented

See https://minecraft.wiki/w/Experience#Values_from_Java_Edition_1.3.1_to_1.8_(14w02a) for reference.

public static int getXPValueFromLevel(int xpLevel)
{
int val = 0;
if(xpLevel >= 30)
	val = (int) (3.5 * Math.pow(xpLevel, 2D) - 151.5 * xpLevel + 2220D);
else if(xpLevel >= 15)
	val = (int) (1.5D * Math.pow(xpLevel, 2D) - 29.5 * xpLevel + 360D);
else
	val = 17 * xpLevel;
return val;
}

This matches the math from the wiki exactly.

You can see this by doing the following:

  • set up a Minecraft profile, Forge, with Improvable Skills, Hammerlib, and Create
  • Unlock the Improvable Skills book and note that you have no experience stored, and have no current points or levels
  • Give yourself 9 experience nuggets from Create
  • Shift right click each nugget and you will see your points increase by 3 experience per nugget
  • Once you have done this, you will see that your experience bar shows 3 levels and no points
  • You can verify this with /xp query @s points and /xp query @s levels
  • According to the "Leveling Up" section of the Experience page on the wiki, this would match the expectation of having obtained 27 xp
  • Open the XP bank of Improvable Skills and store all
  • It will show 51 xp
  • Referencing the older experience scale, this matches what you would expect with having 3 levels