Hello Forge Community,
I am relatively new to modding so please be patient, also I apologize if I make beginner mistakes. Currently I'm re-writing a 1.8.9 HUD mod that would display various text and items to the screen. When I wrote the original mod I didn't follow config file conventions, because I was more focused on making my first mod. But now I would like to understand the convention and the correct way of using ".cfg" files. I have been googling to see if others have any tutorials, or have asked on the forums about config files but I cant find any up to date resources (I'm not sure what the latest config convention is).
My Goal:
What I am trying to accomplish is, be able to read in values from a config file such as (int x, int y, boolean enabled, String name, int color) for different HUD sub-mods. Then update them via chat commands and save them to the config file again. I am willing to write this mod in 1.16.x if the config implementation has been upgraded since 1.12.2 and would appreciate any information/tutorials for doing so.
Steps I've Taken:
I began with the Forge Documentation but was unable to see any information of config files for 1.16.x , I might have been just looking in the wrong place.
I did look back at the 1.12.x Documentation and found config annotations. (I also followed the link to the annotation testing GitHub repo)
When I made an attempt to implement these I was able to create a "ModConfig.java" that created a ".cfg" file that was correctly structured for how it was defined, but I was unable to update the values and save them to the config file when running the mod. I was using `ConfigManager.sync(MODID, Type.INSTANCE)` to attempt to write the updated values to the file but It would overwrite the values in the code before saving, I think this is due to me modifying it by just setting the fields and not using GUI but I'm not sure.
I appreciate any and all help on this topic and if you require more information I can provide it. Thank you in advance for your time!
Files:
Here is the mod entry point file ->"CryoHudMod.java", and my config annotated file -> "ModConfig.java", and the generated "cryo-hud-mod.cfg".