This is a built-in file template used to create a new config class for Forge projects 1.20 and above
+ + diff --git a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft index 360d7d11a..af36d796e 100644 --- a/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft +++ b/src/main/resources/fileTemplates/j2ee/forge/Forge (1.20+) Main Class.java.ft @@ -18,7 +18,9 @@ import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -77,12 +79,22 @@ public class ${CLASS_NAME} { // Register the item to a creative tab modEventBus.addListener(this::addCreative); + + // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us + ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); } private void commonSetup(final FMLCommonSetupEvent event) { // Some common setup code LOGGER.info("HELLO FROM COMMON SETUP"); LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); + + if (Config.logDirtBlock) + LOGGER.info("DIRT BLOCK >> {}", ForgeRegistries.BLOCKS.getKey(Blocks.DIRT)); + + LOGGER.info(Config.magicNumberIntroduction + Config.magicNumber); + + Config.items.forEach((item) -> LOGGER.info("ITEM >> {}", item.toString())); } // Add the example block item to the building blocks tab