Search in sources :

Example 1 with AgriConfigAdapter

use of com.agricraft.agricore.config.AgriConfigAdapter in project AgriCraft by AgriCraft.

the class CoreHandler method preInit.

public static void preInit(FMLPreInitializationEvent event) {
    // Setup Config.
    configDir = event.getSuggestedConfigurationFile().getParentFile().toPath().resolve(Reference.MOD_ID);
    config = new Configuration(configDir.resolve("config.cfg").toFile());
    // Setup Plant Dir.
    jsonDir = configDir.resolve("json");
    defaultDir = jsonDir.resolve("defaults");
    // Setup Provider
    AgriConfigAdapter provider = new ModProvider(config);
    MinecraftForge.EVENT_BUS.register(provider);
    // Initialize AgriCore
    AgriCore.init(new ModLogger(), new ModTranslator(), new ModValidator(), new ModConverter(), provider);
    // Transfer Defaults
    ResourceHelper.findResources(JSON_FILE_PATTERN.asPredicate()).stream().filter(AGRI_FOLDER_PATTERN.asPredicate()).forEach(r -> ResourceHelper.copyResource(r, configDir.resolve(r), false));
    // Load the JSON files.
    loadJsons();
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) AgriConfigAdapter(com.agricraft.agricore.config.AgriConfigAdapter)

Aggregations

AgriConfigAdapter (com.agricraft.agricore.config.AgriConfigAdapter)1 Configuration (net.minecraftforge.common.config.Configuration)1