mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Unify harvestlevel strings through the library. Also makes them adaptable.
This commit is contained in:
1 parent
49764fd251
commit
258b980605
4 files changed
+37
-47
No files matched your search
@@ -0,0 +1,29 @@
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user