Here's a more stable way, that requires only the EnumHelper:
static
{
for (RarityGlowTypeNames value : RarityGlowTypeNames.values())
{
String name = "";
for (String word : value.name().split("_"))
name += word.substring(0, 1) + word.substring(1).toLowerCase() + " ";
EnumHelper.addEnum(RarityGlowType.class, name.substring(0, name.length() - 1), new Class<?>[0]);
}
}
// This is inside the root class for the config file
public static class Inventory
{
@Config.Name("Rarity Type")
public RarityGlowType rarityGlowType = RarityGlowType.values()[0];
}
public enum RarityGlowType {}
public enum RarityGlowTypeNames
{
SOLID_COLOR, GRADIENT_COLOR;
}
Or here's a variant of that without dynamic name generation:
static
{
for (RarityGlowTypeNames name : RarityGlowTypeNames.values())
EnumHelper.addEnum(RarityGlowType.class, name.toString(), new Class<?>[0]);
}
// This is inside the root class for the config file
public static class Inventory
{
@Config.Name("Rarity Type")
public RarityGlowType rarityGlowType = RarityGlowType.values()[0];
}
public enum RarityGlowType {}
public enum RarityGlowTypeNames
{
SOLID_COLOR("Solid Color"),
GRADIENT_COLOR("Gradient Color");
private String name;
private RarityGlowTypeNames(String name)
{
this.name = name;
}
@Override
public String toString()
{
return name;
}
}
An example of checking the value could be:
ConfigMod.inventory.rarityGlowType.ordinal() == RarityGlowTypeNames.GRADIENT_COLOR.ordinal()