Created
January 14, 2013 12:38
-
-
Save aadnk/4529785 to your computer and use it in GitHub Desktop.
Generate the experience tables on Minecraft Wiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.comphenix.testing; | |
class Test { | |
private static int[] xpRequiredForNextLevel; | |
private static int[] xpTotalToReachLevel; | |
public static void main(String[] args) { | |
initLookupTables(50); | |
for (int i = 1; i < 41; i++) { | |
System.out.println(xpTotalToReachLevel[i] + "," + xpRequiredForNextLevel[i - 1]); | |
} | |
} | |
// Based on desht excellent ExperienceManager | |
// https://github.com/desht/dhutils/blob/master/Lib/src/main/java/me/desht/dhutils/ExperienceManager.java | |
private static void initLookupTables(int maxLevel) { | |
xpRequiredForNextLevel = new int[maxLevel]; | |
xpTotalToReachLevel = new int[maxLevel]; | |
xpTotalToReachLevel[0] = 0; | |
// Valid for MC 1.3 and later | |
int incr = 17; | |
for (int i = 1; i < xpTotalToReachLevel.length; i++) { | |
xpRequiredForNextLevel[i - 1] = incr; | |
xpTotalToReachLevel[i] = xpTotalToReachLevel[i - 1] + incr; | |
if (i >= 30) { | |
incr += 7; | |
} else if (i >= 16) { | |
incr += 3; | |
} | |
} | |
xpRequiredForNextLevel[xpRequiredForNextLevel.length - 1] = incr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment