Cloth Config API (Fabric/Forge/NeoForge)

Cloth Config API (Fabric/Forge/NeoForge)

169M Downloads

[Bug / Feature Request] Propper AutoConfig subfolder support

EwyBoy opened this issue ยท 2 comments

commented

Hey, @shedaniel huge fan of your work and I would like to use Cloth Config for most of my mods going forward. My mods gets very unorganized and not very user-friendly if I have the config in the main folder and my other stuff in a subfolder.

One problem I have is that some of my mods uses a subfolder in the config directory. Like: config/worldstrpper/my_config.json.
From what I can see AutoConfig does not currently properly support subfolders even though they are posible.

Placing the auto generated config in a subfolder is possible right now if you add a / or a \\ in the name of the @config annotation.

@Config(name = "mysubfolder\\config")
public class Config implements ConfigData {}

This works perfectly up until viewing the Config Screen.
image

The problem is that Minecraft can't handle / or a \\ in the lang files and it breaks the paths used for translation and localization.
Both this
image
nor this works.
image

Would be nice if the config file name string could be checked for / or a \\ and converted to . where it is used for localization.

I am willing to make a PR myself and fix this but not sure how you would like the implementation hence why I am creating this issue first. Another way of implementing this would be to have the @config() have an optional subfolder parameter.

I know you probably not intended for the name parameter to be used for defining the path of the config like how I am abusing it to create the file in a subdirectory but it would be very useful for me to do so with proper localization.

Any thoughts on this and on how it could be implemented?

commented

I wanted to do the same as you and was trying to figure out how.
I came across this: https://shedaniel.gitbook.io/cloth-config/auto-config/partitioning-the-config
Which solves your issue, if you only want 1 config file you just make 1 module named config.
In that case it'll create a config.json inside a folder named after your modid.
In the lang file you can then use:
"text.autoconfig.worldstripper.option.config.stripRadiusX" etc

Hopefully the answer is still useful for you and otherwise maybe for others that having the same issue

commented

It seems this got fully fixed now. Using / seems to work fine for me with both creating a sub folder and translations.
No clue when this got fixed