Skip to content

Migrating to 3.0.0

Ang edited this page Nov 18, 2022 · 1 revision

What changed?

3.0.0 introduces a ton of new features, and cleans up a lot of Paragon's internal code. Upon updating, you may notice that almost everything related to your config is deprecated. If you try to run the game, your config will not be registered. This is because you need to update to the new config system.

Here is a list of classes that have been changed

  • BaseModConfig > Config
  • ConfigRegistry > ConfigManager

Other config types such as JSONModConfig have also been deprecated. This is due to the introduction of serializers.

Migrating your code

Below is an example of an old config class.

public class TestModConfig implements JSONModConfig {
    public static final ConfigOption<String> DISCORD_USERNAME = new ConfigOption<>("username", new String("acee#1220"));

    @Override
    public String getModId() {
        return "paragon";
    }
}

And below is an example of a new config class.

public class TestModConfig implements Config {
    public static final ConfigOption<String> DISCORD_USERNAME = new ConfigOption<>("username", new String("acee#1220"));
}

The default serializer is JSON, so this example will use JSON. If you're interested in changing that, visit this page. Now, we must also make some changes to registration. Instead of using the ConfigRegistry class, we now use the ConfigManager class. You may of noticed that the getModId() method was removed in the new config class example. This is because you now have to register your config alongside your mod id. Here's an example

ConfigManager.register("paragon", new TestModConfig());

Paragon is a simple, easy-to-use and lightweight config library.

Clone this wiki locally