/** * Creates a new Configuration object. * * Do NOT make this the same as the overall mod configuration; it will clobber it! * * @param confName The config file name (without path or .json suffix) * @param logger The logger to send debug info to. */ public Configuration(String confName, Logger logger) { this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".json"; this.logger = logger; }
/** * Creates a new Configuration object. * * Do NOT make this the same as the overall mod configuration; it will clobber it! * * @param confName The config file name (without path or .cfg suffix) * @param description The description for the group that the config entries will be placed in. */ public ForgeCFG(String confName, String description) { this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".cfg"; this.description = description.toLowerCase(Locale.US); }
public static File getConfigDir() { return new File(Loader.instance().getConfigDir(), "CustomOreGen"); }
public ModuleContainer(String containerID, ContainerState state) { this.containerID = containerID; this.state = state; loadedModules = new LinkedHashSet<>(); unloadedModules = new LinkedHashSet<>(); configFolder = new File(Loader.instance().getConfigDir(), Constants.FORESTRY_CONFIG_FOLDER + containerID); configModules = new Configuration(new File(configFolder, "modules.cfg")); configHandlers = new HashSet<>(); }
public static void loadConfig() { File configFile = new File(Loader.instance().getConfigDir(), "ice_and_fire.cfg"); if (!configFile.exists()) { try { configFile.createNewFile(); } catch (Exception e) { logger.warn("Could not create a new Ice and Fire config file."); logger.warn(e.getLocalizedMessage()); } } config = new Configuration(configFile); config.load(); }
/** * Base constructor for a configuration handler. The purpose of this class is to provide a * basic wrapper for Forge's configuration, but mostly to add support for special * configuration based annotations. * * @param name The name of the config file to represent. This should be all lower case and * have no spaces. Basic file name rules. The .cfg extension and forge config * directory is added automatically. */ public ConfigurationHandler(String name) { this.name = name; this.file = new File(Loader.instance().getConfigDir(), name.toLowerCase() + ".cfg"); this.config = new Configuration(this.file); }
public static void initBlacklist() { File jsonConfig = new File(Loader.instance().getConfigDir(), IronBackpacks.MODID + File.separator + "blacklist.json"); InventoryBlacklist blacklist = JsonUtil.fromJson(TypeToken.get(InventoryBlacklist.class), jsonConfig, new InventoryBlacklist()); INSTANCE.itemBlacklist.addAll(blacklist.itemBlacklist); INSTANCE.nbtBlacklist.addAll(blacklist.nbtBlacklist); try { Field inventoryBlacklist = IronBackpacksAPI.class.getDeclaredField("INVENTORY_BLACKLIST"); EnumHelper.setFailsafeFieldValue(inventoryBlacklist, null, INSTANCE); } catch (Exception e) { IronBackpacks.LOGGER.error("Error setting blacklist instance for API usage."); } }
registeredDefinitions.clear(); oreVeinCache.clear(); Path configPath = Loader.instance().getConfigDir().toPath().resolve(GTValues.MODID); Path worldgenRootPath = configPath.resolve("worldgen"); Path jarFileExtractLockOld = configPath.resolve(".worldgen_extracted");
public static void preInit() { /* * Here is where you specify the location from where your config file * will be read, or created if it is not present. * * Loader.instance().getConfigDir() returns the default config directory * and you specify the name of the config file, together this works * similar to the old getSuggestedConfigurationFile() function. */ File configFile = new File(Loader.instance().getConfigDir(), "MinecraftByExample.cfg"); // initialize your configuration object with your configuration file values. config = new Configuration(configFile); // load config from file (see mbe70 package for more info) syncFromFile(); }
ranksFile = FTBUtilitiesConfig.ranks.load_from_config_folder ? new File(Loader.instance().getConfigDir(), "ftbutilities_ranks.txt") : new File(universe.server.getDataDirectory(), "local/ftbutilities/ranks.txt");
private static void initialise() { updateMap = new HashMap<String, UpdateEntry>(); /* * The time between update checks in minutes. * A value <=0 will only run the updater when a player joins the world. */ int Timer = 60*60*20; try{ config = new Configuration(new File(Loader.instance().getConfigDir(), "MUD.cfg")); Timer = config.get(Configuration.CATEGORY_GENERAL, "Update Time", 60, "The time in minutes between update checks").getInt() * 60 * 20; check = config.get(Configuration.CATEGORY_GENERAL, "Update Check Enabled", true, "Should MUD automatically check for updates"); verbose = config.getBoolean("Chat stats", Configuration.CATEGORY_GENERAL, false, "Should MUD print in chat its status"); enabled = check.getBoolean(); deleteOld = config.getBoolean("Remove old file", Configuration.CATEGORY_GENERAL, true, "Should MUD try to remove old file when download is complete"); deleteFailed = config.getBoolean("Remove failed download", Configuration.CATEGORY_GENERAL, true, "Should MUD try to remove the new file created if download is failed"); if(config.hasChanged()){ config.save(); } }catch(Exception handled){ handled.printStackTrace(); } Object listener = new ModUpdateDetectorTickHandeler(Timer); MinecraftForge.EVENT_BUS.register(listener); ClientCommandHandler.instance.registerCommand(new MudCommands()); }
this.config = new Config(new File(Loader.instance().getConfigDir(), ModData.MOD_NAME+"/")); this.config.loadValues();
@EventHandler public void load(FMLInitializationEvent event) { // This is the place where the mod starts loading File configsDir = new File(Loader.instance().getConfigDir(), "TerrainControl"); this.worldLoader = new WorldLoader(configsDir); // Create the world type. WorldType registers itself in the constructor // - that is Mojang code, so don't blame me this.worldType = new TXWorldType(this.worldLoader); // Start TerrainControl engine final ForgeEngine engine = new ForgeEngine(this.worldLoader); TerrainControl.setEngine(engine); // Register Default biome generator to TerrainControl engine.getBiomeModeManager().register(VanillaBiomeGenerator.GENERATOR_NAME, ForgeVanillaBiomeGenerator.class); // Register village and rare building starts MapGenStructureIO.registerStructure(TXRareBuildingStart.class, StructureNames.RARE_BUILDING); MapGenStructureIO.registerStructure(TXVillageStart.class, StructureNames.VILLAGE); // Register sapling tracker, for custom tree growth. SaplingListener saplingListener = new SaplingListener(this.worldLoader); MinecraftForge.TERRAIN_GEN_BUS.register(saplingListener); MinecraftForge.EVENT_BUS.register(this.worldLoader); MinecraftForge.EVENT_BUS.register(saplingListener); // Register to our own events, so that they can be fired again as Forge events. engine.registerEventHandler(new TCToForgeEventConverter(), EventPriority.CANCELABLE); }
return; if(Loader.instance().getConfigDir() == null) { return; Configs.CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "LogisticsPipes.cfg")); Configs.CONFIGURATION.load(); Configs.loaded = true;