https://pastebin.com/LnRcubaZ
Log ^
Constructor
public HardModeOresMod() {
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, HardModeOresConfig.COMMON_SPEC);
HardModeOresFeatureRegistry.register(modEventBus);
HardModeOresRegistry.BLOCK_REGISTRY.register(modEventBus);
HardModeOresRegistry.ITEM_REGISTRY.register(modEventBus);
}
Example where I'm trying to use the config values
public static final RegistryObject<ConfiguredFeature<?, ?>> ORE_IRON_CFG = CONFIGURED_FEATURES.register("ore_rich_iron", () -> new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(ORE_IRON_TARGET_LIST.get(), HardModeOresConfig.COMMON.IronMaxVeinSize.get())));
Config Constructor
public static final Common COMMON;
public static final ForgeConfigSpec COMMON_SPEC;
static //constructor
{
Pair<Common, ForgeConfigSpec> commonSpecPair = new ForgeConfigSpec.Builder().configure(Common::new);
COMMON = commonSpecPair.getLeft();
COMMON_SPEC = commonSpecPair.getRight();
}
Common Constructor
public Common(ForgeConfigSpec.Builder builder)
{
builder.push("Ores");
this.IronMaxVeinSize = builder.worldRestart().define("Rich Iron Max Vein Size", defaultIronMaxVeinSize);
this.GoldMaxVeinSize = builder.worldRestart().define("Rich Gold Max Vein Size", defaultGoldMaxVeinSize);
this.DiamondMaxVeinSize = builder.worldRestart().define("Rich Diamond Max Vein Size", defaultDiamondMaxVeinSize);
builder.pop();
}
Should be everything relevant. Note that despite the Config being named 'Common', it is using the Server config type, and is still failing in the same way.
It seems that Configs are not loaded until server/world start, but OreGeneration Registration is registered when opening the world creation screen. Does this mean that it is now impossible to use ForgeConfig to configure OreGeneration?