Jump to content

Recommended Posts

Posted

Hello,

 

I have a configuration file from wich I can read my entries , and set new ones , but how can I modifiy entires , because I only found the config.get[params] to edit , but it just creates a new one , or changes the default state , so again my question is how can you edit a property in configs from your mod ?

 

THanks to anyone having an answer to this simple question

Posted
	Configuration config = new Configuration(event.getSuggestedConfigurationFile(), true);

	config.load();
	config.get("Booleans", "Boolean1", false).set(true);
	config.save();

Kain

Posted

Yes.  If you use a get method like getBoolean() it will just get a boolean value which you can't of course use to set, but if you use the get() method you get the Property from the file and from that you can further set it.

 

Note that you're asking about this because you want users to be able to change the config options, you should consider the new Forge config GUI functionality.  Basically it creates a standardized options setting interface.  There is tutorial here:  http://minalien.com/minecraft-forge-feature-spotlight-config-guis/

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.