Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, I am trying to write to a config file in MC 1.8.9. I type in the new value (90, previously 45), press done, and I go back in the config, and it's 45 again! Code to write to value:

public static void syncConfig() {
	    try {
	        config.load();
	        
	        Property configFOV = config.get(Configuration.CATEGORY_GENERAL,
	                "FOV",
	                "45",
	                "Amount to zoom to");

	        FOVVal = configFOV.getInt();
	        System.out.println(FOVVal);
	    } catch (Exception error) {
	        
	    } finally {
	        config.save();
	    }
	}

Code for detecting if done button is pushed:

protected void actionPerformed(GuiButton button)
    {
        if (button.id == 2000)
        {
        	FOVMod.syncConfig();
            boolean flag = true;
            try
            {
                if ((configID != null || parentScreen == null || !(parentScreen instanceof FOVGuiConfig)) 
                        && (entryList.hasChangedEntry(true)))
                {
                    boolean requiresMcRestart = entryList.saveConfigElements();

                    if (Loader.isModLoaded(Reference.MODID))
                    {
                        ConfigChangedEvent event = new OnConfigChangedEvent(Reference.MODID, "FOV", isWorldRunning, false);
                        MinecraftForge.EVENT_BUS.post(event);
                        if (!event.getResult().equals(Result.DENY))
                            MinecraftForge.EVENT_BUS.post(new PostConfigChangedEvent(Reference.MODID, "FOV", isWorldRunning, false));
                        
                        if (requiresMcRestart)
                        {
                            flag = false;
                            mc.displayGuiScreen(new GuiMessageDialog(parentScreen, "fml.configgui.gameRestartTitle", 
                                    new ChatComponentText(I18n.format("fml.configgui.gameRestartRequired")), "fml.configgui.confirmRestartMessage"));
                        }
                        
                        if (parentScreen instanceof FOVGuiConfig)
                            ((FOVGuiConfig) parentScreen).needsRefresh = true;
                    }
                }
            }
            catch (Throwable e)
            {
                e.printStackTrace();
            }
            
            if (flag)
                mc.displayGuiScreen(parentScreen);
        }
    }

I have been working on this for hours, and any help would be appreciated greatly. Thanks!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.