Jump to content

[1.8] onConfigChangedEvent not detected by my event handler


Recommended Posts

Hey fellow modders,


I followed Forge's example and setup configuration files and the associated gui menu's that appear after clicking my mod's config button by extending GuiConfig and all that good stuff.


However, I'm getting stuck with my event handler that saves my configuration file not receiving the onConfigChangedEvent even though I (supposedly) registered it to the EVENT_BUS.


My code is (generally) as follows:

public class ConfigEventHandler {
    public void onEvent(OnConfigChangedEvent event)
    	System.out.println("Config Changed Event Fired!");
        if (MyMod.MODID.equals(event.modID) && !event.isWorldRunning)
            if (Configuration.CATEGORY_GENERAL.equals(event.configID))
                StartupCommon.syncConfig(false); //my version of syncConfig is almost identical to Forge's
            else if ("miscConfig".equals(event.configID))
                //update miscConfiguration file


InitCommon is similar to GreyGhost's implementation in MinecraftByExample (runs during Init phase in both clients and dedicated servers):

public static void initCommon() {
	//register the save config handler to EVENT_BUS bus
	System.out.println("Registering event handlers...");
	MinecraftForge.EVENT_BUS.register(new ConfigEventHandler());


I'm not sure if my mod's container needs to implement registerBus like ForgeModContainer does. And if it needs to, I am not sure how to override methods of my mod's container since forge creates the container for me.

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.