Posted November 6, 20186 yr When manipulating the Configuration data structure I can set a property on an entry to tell the Gui system what IConfigElement class to use when manipulating that property. I don't see anything like that available for the Config annotation system that Forge provides. I was wondering is if I am overlooking something, or if indeed the annotation system cannot do this if it could be added. My thought would be a new annotation on a Config property where I could specify the class name, and the annotation process would do the magic to set property on the config element. If that is not possible adding a pre/post event for config processing could be useful. In the pre I could set the the IConfigElement property appropriately and perhaps modify the structure somewhat better fit presentation, and on the post it has the potential of doing post processing before being persisted.
November 6, 20186 yr You can get a Configuration for your mod by using ConfigManager.getConfiguration. If you haven't specified the name in your @Config annotation then it will be equal to your modid. That configuration will contain all categories/properties you've specified in your annotation-based config and you can do whatever you want with it just as you would with a normal Configuration.
November 6, 20186 yr From what I can tell annotation-based configs are created and injected when the mod is constructed. So even as early as pre-init should be fine. I've just debugged it and can confirm that the configuration indeed exists at preinit.
November 6, 20186 yr Author Great! Thanks for the info. Now to go off and see if I can get it to do what I want.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.