Jump to content

[1.13.2] An alternative way to getSuggestedConfigurationFile()


tokuhausu

Recommended Posts

  • 3 months later...

It changed from .cfg to .toml and now uses a proper library (electronwill’s nightconfig library with a wrapper for comments and syncing). It was also cleaned up a lot. Configuration doesn’t exist anymore and @Config hasn’t been ported yet. Here’s the commit in which I add an example config to my example mod https://github.com/Cadiboo/Example-Mod/commit/43db50e176d758ade2338764d7e2fe1b63aae7dd

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

On 6/19/2019 at 3:06 AM, Cadiboo said:

It changed from .cfg to .toml and now uses a proper library (electronwill’s nightconfig library with a wrapper for comments and syncing). It was also cleaned up a lot. Configuration doesn’t exist anymore and @Config hasn’t been ported yet. Here’s the commit in which I add an example config to my example mod https://github.com/Cadiboo/Example-Mod/commit/43db50e176d758ade2338764d7e2fe1b63aae7dd

 

Hi,

 

Thanks for posting your example mod! its a real help since forge decided to change everything, however, looking through your code I couldn't figure out how it actaully is you access the values stored in the config? Like how do i determine whether "clientBoolean" is true or false?

 

Thanks!

 

UPDATE:

 

Sorry, I figured out how to get it. However, When i change the file with MC open, the value does not change when im retrieving it. Is this intentional, or am I meant to be doing something else? I did notice that the setValueAndSave() function is never used.

 

Thanks again!

Edited by Vistaf
Update
Link to comment
Share on other sites

The values in the ExampleModConfig class are the “baked” values from the config. They are the runtime representations of the config values (because looking them up each time you use them is expensive) and shouldn’t be changed from outside the “bakeConfig” method. Making them only accessible through getters would be good encapsulation. However, config saving is asynchronous (it happens on another thread) so if you want the correct value that you just set immediately, you’ll need to update it in code yourself. 

 

Edit: I’ll try n find an example

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.