@EventHandler public void loadComplete(FMLLoadCompleteEvent event) { LexiconManager.loadComplete(); TFPlugins.loadComplete(); cleanConfig(false); config.cleanUp(false, true); configClient.cleanUp(false, true); log.info("Load Complete."); }
void loadWorldGeneration() { if (!config.get( "World", "GenerateDefaultFiles", true, "If enabled, Thermal Foundation will create default world generation files - if it cannot find existing ones. Only disable this if you know what you are doing.")) { return; } worldGenOres = new File(CoFHProps.configDir, "/cofh/world/ThermalFoundation-Ores.json"); boolean failConvert = false; File oldGen = new File(CoFHProps.configDir, "/cofh/world/ThermalExpansion-Ores.json"); if (oldGen.exists()) { if (oldGen.renameTo(worldGenOres)) { log.warn( "Thermal Foundation was unable to convert existing world generation! This is really bad - your files are probably write protected and you need to handle it now!"); failConvert = true; } } if (!worldGenOres.exists() && !failConvert) { try { worldGenOres.createNewFile(); CoreUtils.copyFileUsingStream(worldGenInternalOres, worldGenOres); } catch (Throwable t) { t.printStackTrace(); } } }
@EventHandler public void preInit(FMLPreInitializationEvent event) { UpdateManager.registerUpdater(new UpdateManager(this, releaseURL, CoFHProps.DOWNLOAD_URL)); config.setConfiguration( new Configuration( new File(CoFHProps.configDir, "/cofh/thermalfoundation/common.cfg"), true)); configClient.setConfiguration( new Configuration( new File(CoFHProps.configDir, "cofh/thermalfoundation/client.cfg"), true)); tabCommon = new TFCreativeTab(); cleanConfig(true); configOptions(); TFFluids.preInit(); TFItems.preInit(); TFBlocks.preInit(); TFPlugins.preInit(); LexiconManager.preInit(); }
void cleanConfig(boolean preInit) { if (preInit) {} String prefix = "config.thermalfoundation."; String[] categoryNames = config.getCategoryNames().toArray(new String[config.getCategoryNames().size()]); for (int i = 0; i < categoryNames.length; i++) { config .getCategory(categoryNames[i]) .setLanguageKey(prefix + categoryNames[i]) .setRequiresMcRestart(true); } categoryNames = configClient.getCategoryNames().toArray(new String[configClient.getCategoryNames().size()]); for (int i = 0; i < categoryNames.length; i++) { configClient .getCategory(categoryNames[i]) .setLanguageKey(prefix + categoryNames[i]) .setRequiresMcRestart(true); } }
/* LOADING FUNCTIONS */ void configOptions() { String category; String comment; /* Graphics */ TFProps.iconBlazePowder = ThermalFoundation.configClient.get( "Icons", "BlazePowder", TFProps.iconBlazePowder, "Set to FALSE to revert Blaze Powder to the default Minecraft icon."); TFProps.renderStarfieldCage = ThermalFoundation.configClient.get( "Render", "CageyEnder", TFProps.renderStarfieldCage, "Set to TRUE for Ender devices to be a bit more Cagey year-round."); /* Holidays */ category = "Holiday"; comment = "Set this to TRUE to disable April Foolishness."; TFProps.holidayAprilFools = !config.get(category, "IHateApril", false, comment); /* Interface */ category = "Interface.CreativeTab"; boolean armorTab = false; boolean toolTab = false; comment = "Set to TRUE to put Thermal Foundation Armor under the general \"Thermal Foundation\" Creative Tab."; armorTab = configClient.get(category, "ArmorInCommonTab", armorTab); comment = "Set to TRUE to put Thermal Foundation Tools under the general \"Thermal Foundation\" Creative Tab."; toolTab = configClient.get(category, "ToolsInCommonTab", toolTab); /* Equipment */ category = "Equipment"; comment = "Set to TRUE to disable ALL armor sets."; TFProps.disableAllArmor = config.get(category, "DisableAllArmor", TFProps.disableAllArmor, comment); comment = "Set to TRUE to disable ALL tool sets."; TFProps.disableAllTools = config.get(category, "DisableAllTools", TFProps.disableAllTools, comment); comment = "Set to FALSE to hide all disabled equipment from the Creative Tabs and NEI."; TFProps.showDisabledEquipment = config.get(category, "ShowDisabledEquipment", TFProps.showDisabledEquipment, comment); if (armorTab) { tabArmor = tabCommon; } else { if (!TFProps.disableAllArmor || (TFProps.disableAllArmor && TFProps.showDisabledEquipment)) { tabArmor = new TFCreativeTab("Armor") { @Override protected ItemStack getStack() { return Equipment.Invar.armorPlate; } }; } } if (toolTab) { tabTools = tabCommon; } else { if (!TFProps.disableAllTools || (TFProps.disableAllTools && TFProps.showDisabledEquipment)) { tabTools = new TFCreativeTab("Tools") { @Override protected ItemStack getStack() { return Equipment.Invar.toolPickaxe; } }; } } }