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

Is there an (easy) way to set one of your config settings as requiring a Minecraft restart? I see the way to set all to require a restart, but I don't see the place to set only one to that.

 

(I've set up the GUI thanks to the wonderful tutorial at http://minalien.com/minecraft-forge-feature-spotlight-config-guis/ and that part works fine.)

You don't set it in the GuiConfig, instead you set it in your configuration itself.

 

At least by category, there are public methods in the Configuration class such as setCategoryRequiresWorldRestart() and setCategoryRequiresMcRestart(). 

 

Then by property, there are public methods in the Property class such as setRequiresWorldRestart() and setRequiresMcRestart().

 

So I think you can do all in GuiConfig, by category, or by property.

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

  • Author

I'm new to the forge configuration, so I'm kind of lost xD.

 

From what you said and what I can read this looks like it *should* be working:

 

public class ConfigurationHandler
{
    public static Configuration configuration;
    public static boolean spawnerCraftable;
    public static boolean spawnerDropRequireSilk;

    public static void init(File configFile)
    {
        // Create configuration object from given file
        if (configuration == null)
        {
            configuration = new Configuration(configFile);
            loadConfiguration();
        }
    }

    @SubscribeEvent
    public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
    {
        if (event.modID.equalsIgnoreCase(Reference.MOD_ID))
        {
            loadConfiguration();
        }
    }

    private static void loadConfiguration()
    {
        configuration.get("spawnerCraftable", Configuration.CATEGORY_GENERAL, false, "Whether you can craft an Empty spawner from iron bars").setRequiresMcRestart(true);
        spawnerCraftable = configuration.getBoolean("spawnerCraftable", Configuration.CATEGORY_GENERAL, false, "Whether you can craft an Empty spawner from iron bars");
        spawnerDropRequireSilk = configuration.getBoolean("spawnerDropRequireSilk", Configuration.CATEGORY_GENERAL, false, "Whether Empty Spawner drop requires Silk Touch");

        if (configuration.hasChanged())
        {
            configuration.save();
        }
    }
}

 

but the "Requires Minecraft Restart" flag isn't showing up for spawnerCraftable. The only thing that I can see that may be the cause is that the constructor for the GuiConfig overrides with the allRequireMinecraftRestart flag.

 

(Full repo code is at https://github.com/CAD97/SpawnerCraft)

  • Author

Aaaand I'm a derp.

 

configuration.get() takes the category then the field while configuration.getBoolean() takes the field and then the category. I switched them up and got weird results. It works though now!

Guest
This topic is now closed to further replies.

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.