Posted May 23, 20205 yr 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 May 23, 20205 yr by Caffeinated Pinkie
May 24, 20205 yr 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 May 24, 20205 yr by sciwhiz12
May 24, 20205 yr 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.