Jump to content

[1.12.2] Mod Config Annotations Help


captainmk

Recommended Posts

Hello, I'm a fairly new modder, trying to work with 1.12 config annotations for the first time.
Right now I have a working @Config class, and working mod functionality. When the game starts, it correctly loads a boolean from the .cfg, and the mod works as it should.
However, when I change the value at runtime via mod options, it does literally nothing from what I can tell.
Here's the relevant code snippets:

@Config src

@Config(modid = Reference.MODID, name = "touchofalpha", type = Type.INSTANCE)
public class TOAConfig {
    @Comment ({
        "Classic minecraft sunset where light drops in ticks (DEFAULT: true)"
    })
    public static boolean tickingSunset = true;
}


Event handler (doesn't seem to do anything)

@SubscribeEvent
    public void configChange(ConfigChangedEvent event) {
        if (event.getModID().equals(Reference.MODID)) {
            System.out.println(Reference.MODID + ": Configuration changed");
            ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
        }
    }


In the mod I replace the WorldProvider with a custom one, and run the following line in one of the methods:

if (TOAConfig.tickingSunset) {
	// Functional Code Here
}

 

Any help would be appreciated.
Bonus question: How do you ensure that the config option is strictly loaded from the client and not the server? Will the config loading always default to the server's cfg file? The tickingSunset option only needs to happen on the client.

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.