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

I've tried everything I can think of at the moment to register a configuration file for one of my mods in 1.15. I've looked at a bunch of source code from other mods to see what I am doing wrong, but I can't tell what's different.

 

I run this code during the FMLCommonSetupEvent:

ModLoadingContext.get().registerConfig(Type.COMMON, commonSpecPair.getRight());

which references this:

private static final Pair<Common, ForgeConfigSpec> commonSpecPair = new Builder().configure(Common::new);

and creates an instance of:

private static final class Common {
		private final DoubleValue heightWeight, metallicityWeight;
		private final BooleanValue realisticLightning, spawnFire;

		public Common(Builder builder) {
			builder.comment("Common settings").push("General");

			heightWeight = builder.comment("TODO").defineInRange("Height Weight", .5, 0, 1);
			metallicityWeight = builder.comment("TODO").defineInRange("Metallicity Weight", .5, 0, 1);
			realisticLightning = builder.comment("TODO").define("Realistic Lightning", true);
			spawnFire = builder.comment("TODO").define("Spawn Fire", true);

			builder.pop();
		}
	}

 

However, the configuration file is never created and no log messages are given that could give me a hint as to what is going wrong.

 

Update: I've only found one workaround that makes it generate correctly. I don't think it's the proper way to do this, so I'm hoping for a better method. I just have to run this after registering the config.

ConfigTracker.INSTANCE.loadConfigs(Type.COMMON, FMLPaths.CONFIGDIR.get());

 

Edited by Caffeinated Pinkie

Put your registerConfig call in your mod constructor.

Mod event order:

  • Mod construction (move yourregisterConfig here)
  • RegistryEvent.Register<T>
  • Config loading
  • Common setup (your registerConfig was in here)
  • Sided setup
  • ...

See ModLoader.loadMods, line 152 for source.

Edited by sciwhiz12

  • Author
9 hours ago, sciwhiz12 said:

Put your registerConfig call in your mod constructor.

Mod event order:

  • Mod construction (move yourregisterConfig here)
  • RegistryEvent.Register<T>
  • Config loading
  • Common setup (your registerConfig was in here)
  • Sided setup
  • ...

See ModLoader.loadMods, line 152 for source.

Alright, that works. I was registering it in a static FMLCommonSetupEvent method that was registered with @EventBusSubscriber and @SubscribeEvent.

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.