Posted July 25, 201411 yr 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
July 25, 201411 yr Configuration config = new Configuration(event.getSuggestedConfigurationFile(), true); config.load(); config.get("Booleans", "Boolean1", false).set(true); config.save(); Kain
July 25, 201411 yr 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.