Jump to content

Add categories and default values to new config system


Choonster

Recommended Posts

I just tried to port my old configuration to the new annotation-based system and noticed two missing features: default values and categories.

 

I understand the new system is still a WIP, so these may already be on the roadmap.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Default values are the values from the static initializes of your fields.

As for categories, you can make sub-objects. See here: https://github.com/MinecraftForge/Mercurius/blob/master/src/main/java/net/minecraftforge/mercurius/Config.java

I'm not sure i want to move things into TOP level categories. I'd more rather change the top level from "general" to "ModID" or something. But I havent decided yet.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Default values are the values from the static initializes of your fields.

As for categories, you can make sub-objects. See here: https://github.com/MinecraftForge/Mercurius/blob/master/src/main/java/net/minecraftforge/mercurius/Config.java

I'm not sure i want to move things into TOP level categories. I'd more rather change the top level from "general" to "ModID" or something. But I havent decided yet.

 

Thanks, that makes sense.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Yes, but you have to use the internal config object that is created by the manager.

The GUI is part that I haven't gotten around to doing quite yet.

Using the GUI system is really easy it just needs to be glued together.

https://github.com/MinecraftForge/Mercurius/blob/master/1.9.4/src/main/java/net/minecraftforge/mercurius/binding/ModConfigGui.java#L40 being the example of how to use it in this style setup.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Yes, but you have to use the internal config object that is created by the manager.

The GUI is part that I haven't gotten around to doing quite yet.

Using the GUI system is really easy it just needs to be glued together.

https://github.com/MinecraftForge/Mercurius/blob/master/1.9.4/src/main/java/net/minecraftforge/mercurius/binding/ModConfigGui.java#L40 being the example of how to use it in this style setup.

 

Thanks, I ended up with this. Is there a way to do this without using reflection to access

ConfigManager#CONFIGS

?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Btw, have you thought about giving modders the option to separate "global" and "user" configs? That would be especially helpful for modpacks, since users could still change some settings (like the tooltip position for Waila/OneProbe) without getting them overwritten every time the modpack gets updated.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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