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();
}
Aggregations