The Meaning of Life, the Universe, and Everything.
Location:
Tucson, Arizona
Join Date:
10/31/2011
Posts:
219
Location:
Tucson, AZ, USA
Minecraft:
ThatBenderGuy
Nintendo:
1435-8432-4174
Member Details
So I have an config class that uses annotations to set up
@Config(modid = Reference.MODID)
@Config.LangKey("gui.config.main_title")
public class OomConfig {
private static OreReg IRON_ORE = new OreReg("minecraft:iron_ore", 1200, true);
private static OreReg GOLD_ORE = new OreReg("minecraft:gold_ore", 1800, true);
private static OreReg DIAMOND_ORE = new OreReg("minecraft:diamond_ore", 2000, false);
@Config.Comment("Holds all the ores compatible with this mod")
public static final OreReg[] ORE_LIST =
{
IRON_ORE, GOLD_ORE, DIAMOND_ORE
};
public static class OreReg
{
public OreReg(final String registry, final int cooldown, final boolean dropNewOre)
{
this.registry = registry;
this.cooldown = cooldown;
this.dropNewOre = dropNewOre;
}
@Config.Comment("The registry for the block")
public String registry;
@Config.Comment("The Cooldown for the ore")
public int cooldown;
@Config.Comment("Whether or not to drop the new ore")
public boolean dropNewOre;
}
public static class ConfigEventHandler
{
@SubscribeEvent
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent e)
{
if(e.getModID().equals(Reference.MODID))
{
ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
}
}
}
But my problem is that it sets the IRON_ORE, GOLD_ORE, and DIAMOND_ORE outside of my ORE_LIST array in both the file and the config GUI. I have tried making the OreReg objects public, private, I've tried instantiating them inside the array but that doesn't work either. What am I doing wrong? I know they can be in that array because I tried manually editing the config file and putting them inside the ORE_LIST config array and it shows up correctly in the mod config gui. I need it like this to make it easy for users to add ore and make it compatible with my mod. Any help with this would be greatly appreciated.
----------------------EDIT----------------------
Nevermind I figured it out. I had to do a bit of class nesting like so:
@Config(modid = Reference.MODID, name="OreOverhaul/OreOverhaul")
@Config.LangKey("config.oom:title")
public class OomConfig {
@Config.Name("ores")
public static OreList oreList = new OreList();
@Config.LangKey("config.oom:ores")
public static class OreList {
public OreReg IRON_ORE = new OreReg("minecraft:iron_ore", 1200, true);
public OreReg GOLD_ORE = new OreReg("minecraft:gold_ore", 1800, true);
public OreReg DIAMOND_ORE = new OreReg("minecraft:diamond_ore", 2000, false);
public class OreReg
{
public OreReg(final String registry, final int cooldown, final boolean dropNewOre)
{
this.registry = registry;
this.cooldown = cooldown;
this.dropNewOre = dropNewOre;
}
@Config.Comment("The registry for the block")
public String registry;
@Config.Comment("The Cooldown for the ore")
public int cooldown;
@Config.Comment("Whether or not to drop the new ore")
public boolean dropNewOre;
}
}
public static class ConfigEventHandler
{
@SubscribeEvent
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent e)
{
if(e.getModID().equals(Reference.MODID))
{
ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
}
}
}
So I have an config class that uses annotations to set up
But my problem is that it sets the IRON_ORE, GOLD_ORE, and DIAMOND_ORE outside of my ORE_LIST array in both the file and the config GUI. I have tried making the OreReg objects public, private, I've tried instantiating them inside the array but that doesn't work either. What am I doing wrong? I know they can be in that array because I tried manually editing the config file and putting them inside the ORE_LIST config array and it shows up correctly in the mod config gui. I need it like this to make it easy for users to add ore and make it compatible with my mod. Any help with this would be greatly appreciated.
----------------------EDIT----------------------
Nevermind I figured it out. I had to do a bit of class nesting like so:
Someday I'll return to the Blueheart Glacier and sleep for a thousand years.