Jump to content

Phylogeny

Members
  • Posts

    4
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Phylogeny's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Well, that's unfortunate. I haven't looked much at the backend of the config annotations system, but perhaps calling Enum#toString rather than Enum#name will work without breaking anything else.
  2. I see. Then in the mean time, my next questions is: How stable is the solution I posted? Is this a "that's just not the intended usage" objection, or a "that can cause actual problems" objection?
  3. An enum is what tells Forge to generate a cycling button config element. Do you have a constructive suggestions as to how to tell Forge to create one with formatted text (with or without an enum)? It helps to give input on what should be done, as well a what shouldn't.
  4. 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()
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.