Package net.minecraftforge.common.config

Examples of net.minecraftforge.common.config.Configuration


  public static void runPreInit() {
    stage = Stage.SETUP;
    Locale locale = Locale.getDefault();
    Locale.setDefault(Locale.ENGLISH);

    Configuration config = new Configuration(new File(Forestry.instance.getConfigFolder(), MODULE_CONFIG_FILE_NAME));

    config.load();
    config.addCustomCategoryComment(CATEGORY_MODULES, "Disabling these modules can greatly change how the mod functions.\n"
        + "Your mileage may vary, please report any issues.");

    Set<Module> toLoad = EnumSet.allOf(Module.class);
    Iterator<Module> it = toLoad.iterator();
    while (it.hasNext()) {
      Module m = it.next();
      if (m == Module.CORE)
        continue;
      if (!isEnabled(config, m)) {
        it.remove();
        Proxies.log.info("Module disabled: {0}", m);
        continue;
      }
      ForestryPlugin plugin = m.instance;
      if (!plugin.isAvailable()) {
        it.remove();
        Proxies.log.info("Module {0} failed to load: {1}", plugin, plugin.getFailMessage());
        continue;
      }
    }
    boolean changed;
    do {
      changed = false;
      it = toLoad.iterator();
      while (it.hasNext()) {
        Module m = it.next();
        Set<Module> deps = m.instance().getDependancies();
        if (!toLoad.containsAll(deps)) {
          it.remove();
          changed = true;
          Proxies.log.warning("Module {0} is missing dependancies: {1}", m, deps);
          continue;
        }
      }
    } while (changed);

    unloadedModules.removeAll(toLoad);
    loadedModules.addAll(toLoad);

    if (config.hasChanged())
      config.save();

    Locale.setDefault(locale);

    stage = Stage.PRE_INIT;
    for (Module m : loadedModules) {
View Full Code Here


 
  private final Map<String, Setting> settings = new HashMap<String, Setting>();
  private final List<Setting> syncedSettings = new ArrayList<Setting>();
 
  public Config(File file) {
    forgeConfig = new Configuration(file);
  }
View Full Code Here

 
  private Configuration langDatabase;
  private long saveThreadTime = 0;
 
  public ServerProxy() {
    langDatabase = new Configuration(new File("config/LogisticsPipes-LangDatabase.cfg"));
  }
View Full Code Here

 
  private static boolean loaded = false;
  public static void load() {
    if(loaded) return;
    if(Loader.instance().getConfigDir() == null) return;
    CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "LogisticsPipes.cfg"));
    CONFIGURATION.load();
    loaded = true;

    if (CONFIGURATION.hasCategory("logisticspipe.id")
        || CONFIGURATION.hasCategory("logisticsPipe.id")) {
View Full Code Here

        Game.log(Level.INFO, "Railcraft Config: Doing preinit parsing");

        Locale locale = Locale.getDefault();
        Locale.setDefault(Locale.ENGLISH);

        configMain = new Configuration(new File(Railcraft.getMod().getConfigFolder(), "railcraft.cfg"));
        configMain.load();

        configBlock = new Configuration(new File(Railcraft.getMod().getConfigFolder(), "blocks.cfg"));
        configBlock.load();

        configItems = new Configuration(new File(Railcraft.getMod().getConfigFolder(), "items.cfg"));
        configItems.load();

        doUpdateCheck = get("check.version.online", true, "change to '{t}=false' to disable latest version checking");

        playSounds = get("play.sounds", true, "change to '{t}=false' to prevent all mod sounds from playing");
View Full Code Here

    public static void preInit() {
        stage = Stage.PRE_INIT;
        Locale locale = Locale.getDefault();
        Locale.setDefault(Locale.ENGLISH);

        Configuration config = new Configuration(new File(Railcraft.getMod().getConfigFolder(), MODULE_CONFIG_FILE_NAME));

        config.load();
        config.addCustomCategoryComment(CATEGORY_MODULES, "Disabling these modules can greatly change how the mod functions.\n"
                + "For example, disabling the Train Module will prevent you from linking carts.\n"
                + "Disabling the World Module will disable all world gen.\n"
                + "Disabling the Energy Module will remove the energy requirement from machines, "
                + "but will only do so if Forestry or Buildcraft are not installed.");

        Set<Module> toLoad = EnumSet.allOf(Module.class);
        Iterator<Module> it = toLoad.iterator();
        while (it.hasNext()) {
            Module m = it.next();
            if (m == Module.CORE)
                continue;
            if (!isEnabled(config, m)) {
                it.remove();
                Game.log(Level.INFO, "Module disabled: {0}", m);
                continue;
            }
            RailcraftModule inst = m.instance;
            if (inst == null) {
                it.remove();
                Game.log(Level.INFO, "Module not found: {0}", m);
                continue;
            }
            if (!inst.canModuleLoad()) {
                it.remove();
                inst.printLoadError();
                continue;
            }
        }
        boolean changed;
        do {
            changed = false;
            it = toLoad.iterator();
            while (it.hasNext()) {
                Module m = it.next();
                if (m.instance == null)
                    continue;
                Set<Module> deps = m.instance.getDependencies();
                if (!toLoad.containsAll(deps)) {
                    it.remove();
                    changed = true;
                    Game.log(Level.WARN, "Module {0} is missing dependancies: {1}", m, deps);
                    continue;
                }
            }
        } while (changed);

        unloadedModules.removeAll(toLoad);
        loadedModules.addAll(toLoad);

        if (config.hasChanged())
            config.save();

        Locale.setDefault(locale);

        for (Module m : loadedModules) {
            preInit(m);
View Full Code Here

    public static void init(File configFile)
    {
        if (configuration == null)
        {
            configuration = new Configuration(configFile);
            loadConfiguration();
        }
    }
View Full Code Here

    {
        String location = Loader.instance().getConfigDir().getPath();
        File newFile = new File(location + File.separator + "TwilightForest.cfg");
        if (newFile.exists())
        {
            Configuration config = new Configuration(newFile);

            config.load();

            twilightForestDimensionID = config.get("dimension", "dimensionID", -100).getInt();
            TConstruct.logger.trace("Twilight Forest Dim ID: " + twilightForestDimensionID);
        }
        else
            twilightForestDimensionID = -100;
    }
View Full Code Here

    {
        String location = Loader.instance().getConfigDir().getPath();
        File newFile = new File(location + File.separator + "biomesoplenty" + File.separator + "ids.cfg");
        if (newFile.exists())
        {
            Configuration config = new Configuration(newFile);

            config.load();

            promisedLandDimensionID = config.get("dimension settings", "Promised Land Dimension ID", -200).getInt();
            TConstruct.logger.trace("Promised Lands Dim ID: " + promisedLandDimensionID);
        }
        else
            promisedLandDimensionID = -100;
    }
View Full Code Here

    public static void init(File configFile)
    {
        // Create the configuration object from the given configuration file
        if (configuration == null)
        {
            configuration = new Configuration(configFile);
            loadConfiguration();
        }
    }
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.config.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.