Files
TinkersConstruct/src/main/java/tconstruct/library/util/HarvestLevels.java
T

30 lines
897 B
Java

package tconstruct.library.util;
import net.minecraft.util.StatCollector;
import java.util.HashMap;
import java.util.Map;
/**
* Lookup for the name of each harvest level. Use this clientside only for display purposes.
*/
public final class HarvestLevels {
private HarvestLevels() {} // non-instantiable
public static final Map<Integer, String> harvestLevelNames = new HashMap<Integer, String>();
public static String getHarvestLevelName (int num) {
return harvestLevelNames.containsKey(num) ? harvestLevelNames.get(num) : String.valueOf(num);
}
// initialization
static{
String base = "gui.partcrafter.mining";
int i = 0;
while(StatCollector.canTranslate(String.format("%s%d", base, i+1))) {
harvestLevelNames.put(i, StatCollector.translateToLocal(String.format("%s%d", base, i + 1)));
i++;
}
}
}