net.minecraftforge.fml.common.Loader.getConfigDir()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(204)

本文整理了Java中net.minecraftforge.fml.common.Loader.getConfigDir()方法的一些代码示例,展示了Loader.getConfigDir()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.getConfigDir()方法的具体详情如下:
包路径:net.minecraftforge.fml.common.Loader
类名称:Loader
方法名:getConfigDir

Loader.getConfigDir介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/Mantle

  1. /**
  2. * Creates a new Configuration object.
  3. *
  4. * Do NOT make this the same as the overall mod configuration; it will clobber it!
  5. *
  6. * @param confName The config file name (without path or .json suffix)
  7. * @param logger The logger to send debug info to.
  8. */
  9. public Configuration(String confName, Logger logger) {
  10. this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".json";
  11. this.logger = logger;
  12. }

代码示例来源:origin: SlimeKnights/Mantle

  1. /**
  2. * Creates a new Configuration object.
  3. *
  4. * Do NOT make this the same as the overall mod configuration; it will clobber it!
  5. *
  6. * @param confName The config file name (without path or .cfg suffix)
  7. * @param description The description for the group that the config entries will be placed in.
  8. */
  9. public ForgeCFG(String confName, String description)
  10. {
  11. this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".cfg";
  12. this.description = description.toLowerCase(Locale.US);
  13. }

代码示例来源:origin: lawremi/CustomOreGen

  1. public static File getConfigDir() {
  2. return new File(Loader.instance().getConfigDir(), "CustomOreGen");
  3. }

代码示例来源:origin: ForestryMC/Binnie

  1. public ModuleContainer(String containerID, ContainerState state) {
  2. this.containerID = containerID;
  3. this.state = state;
  4. loadedModules = new LinkedHashSet<>();
  5. unloadedModules = new LinkedHashSet<>();
  6. configFolder = new File(Loader.instance().getConfigDir(), Constants.FORESTRY_CONFIG_FOLDER + containerID);
  7. configModules = new Configuration(new File(configFolder, "modules.cfg"));
  8. configHandlers = new HashSet<>();
  9. }

代码示例来源:origin: Alex-the-666/Ice_and_Fire

  1. public static void loadConfig() {
  2. File configFile = new File(Loader.instance().getConfigDir(), "ice_and_fire.cfg");
  3. if (!configFile.exists()) {
  4. try {
  5. configFile.createNewFile();
  6. } catch (Exception e) {
  7. logger.warn("Could not create a new Ice and Fire config file.");
  8. logger.warn(e.getLocalizedMessage());
  9. }
  10. }
  11. config = new Configuration(configFile);
  12. config.load();
  13. }

代码示例来源:origin: Darkhax-Minecraft/Bookshelf

  1. /**
  2. * Base constructor for a configuration handler. The purpose of this class is to provide a
  3. * basic wrapper for Forge's configuration, but mostly to add support for special
  4. * configuration based annotations.
  5. *
  6. * @param name The name of the config file to represent. This should be all lower case and
  7. * have no spaces. Basic file name rules. The .cfg extension and forge config
  8. * directory is added automatically.
  9. */
  10. public ConfigurationHandler(String name) {
  11. this.name = name;
  12. this.file = new File(Loader.instance().getConfigDir(), name.toLowerCase() + ".cfg");
  13. this.config = new Configuration(this.file);
  14. }

代码示例来源:origin: gr8pefish/IronBackpacks

  1. public static void initBlacklist() {
  2. File jsonConfig = new File(Loader.instance().getConfigDir(), IronBackpacks.MODID + File.separator + "blacklist.json");
  3. InventoryBlacklist blacklist = JsonUtil.fromJson(TypeToken.get(InventoryBlacklist.class), jsonConfig, new InventoryBlacklist());
  4. INSTANCE.itemBlacklist.addAll(blacklist.itemBlacklist);
  5. INSTANCE.nbtBlacklist.addAll(blacklist.nbtBlacklist);
  6. try {
  7. Field inventoryBlacklist = IronBackpacksAPI.class.getDeclaredField("INVENTORY_BLACKLIST");
  8. EnumHelper.setFailsafeFieldValue(inventoryBlacklist, null, INSTANCE);
  9. } catch (Exception e) {
  10. IronBackpacks.LOGGER.error("Error setting blacklist instance for API usage.");
  11. }
  12. }

代码示例来源:origin: GregTechCE/GregTech

  1. registeredDefinitions.clear();
  2. oreVeinCache.clear();
  3. Path configPath = Loader.instance().getConfigDir().toPath().resolve(GTValues.MODID);
  4. Path worldgenRootPath = configPath.resolve("worldgen");
  5. Path jarFileExtractLockOld = configPath.resolve(".worldgen_extracted");

代码示例来源:origin: TheGreyGhost/MinecraftByExample

  1. public static void preInit()
  2. {
  3. /*
  4. * Here is where you specify the location from where your config file
  5. * will be read, or created if it is not present.
  6. *
  7. * Loader.instance().getConfigDir() returns the default config directory
  8. * and you specify the name of the config file, together this works
  9. * similar to the old getSuggestedConfigurationFile() function.
  10. */
  11. File configFile = new File(Loader.instance().getConfigDir(), "MinecraftByExample.cfg");
  12. // initialize your configuration object with your configuration file values.
  13. config = new Configuration(configFile);
  14. // load config from file (see mbe70 package for more info)
  15. syncFromFile();
  16. }

代码示例来源:origin: FTBTeam/FTB-Utilities

  1. ranksFile = FTBUtilitiesConfig.ranks.load_from_config_folder ? new File(Loader.instance().getConfigDir(), "ftbutilities_ranks.txt") : new File(universe.server.getDataDirectory(), "local/ftbutilities/ranks.txt");

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

  1. private static void initialise() {
  2. updateMap = new HashMap<String, UpdateEntry>();
  3. /*
  4. * The time between update checks in minutes.
  5. * A value <=0 will only run the updater when a player joins the world.
  6. */
  7. int Timer = 60*60*20;
  8. try{
  9. config = new Configuration(new File(Loader.instance().getConfigDir(), "MUD.cfg"));
  10. Timer = config.get(Configuration.CATEGORY_GENERAL, "Update Time", 60, "The time in minutes between update checks").getInt() * 60 * 20;
  11. check = config.get(Configuration.CATEGORY_GENERAL, "Update Check Enabled", true, "Should MUD automatically check for updates");
  12. verbose = config.getBoolean("Chat stats", Configuration.CATEGORY_GENERAL, false, "Should MUD print in chat its status");
  13. enabled = check.getBoolean();
  14. deleteOld = config.getBoolean("Remove old file", Configuration.CATEGORY_GENERAL, true, "Should MUD try to remove old file when download is complete");
  15. deleteFailed = config.getBoolean("Remove failed download", Configuration.CATEGORY_GENERAL, true, "Should MUD try to remove the new file created if download is failed");
  16. if(config.hasChanged()){
  17. config.save();
  18. }
  19. }catch(Exception handled){
  20. handled.printStackTrace();
  21. }
  22. Object listener = new ModUpdateDetectorTickHandeler(Timer);
  23. MinecraftForge.EVENT_BUS.register(listener);
  24. ClientCommandHandler.instance.registerCommand(new MudCommands());
  25. }

代码示例来源:origin: superckl/BiomeTweaker

  1. this.config = new Config(new File(Loader.instance().getConfigDir(), ModData.MOD_NAME+"/"));
  2. this.config.loadValues();

代码示例来源:origin: MCTCP/TerrainControl

  1. @EventHandler
  2. public void load(FMLInitializationEvent event)
  3. {
  4. // This is the place where the mod starts loading
  5. File configsDir = new File(Loader.instance().getConfigDir(), "TerrainControl");
  6. this.worldLoader = new WorldLoader(configsDir);
  7. // Create the world type. WorldType registers itself in the constructor
  8. // - that is Mojang code, so don't blame me
  9. this.worldType = new TXWorldType(this.worldLoader);
  10. // Start TerrainControl engine
  11. final ForgeEngine engine = new ForgeEngine(this.worldLoader);
  12. TerrainControl.setEngine(engine);
  13. // Register Default biome generator to TerrainControl
  14. engine.getBiomeModeManager().register(VanillaBiomeGenerator.GENERATOR_NAME, ForgeVanillaBiomeGenerator.class);
  15. // Register village and rare building starts
  16. MapGenStructureIO.registerStructure(TXRareBuildingStart.class, StructureNames.RARE_BUILDING);
  17. MapGenStructureIO.registerStructure(TXVillageStart.class, StructureNames.VILLAGE);
  18. // Register sapling tracker, for custom tree growth.
  19. SaplingListener saplingListener = new SaplingListener(this.worldLoader);
  20. MinecraftForge.TERRAIN_GEN_BUS.register(saplingListener);
  21. MinecraftForge.EVENT_BUS.register(this.worldLoader);
  22. MinecraftForge.EVENT_BUS.register(saplingListener);
  23. // Register to our own events, so that they can be fired again as Forge events.
  24. engine.registerEventHandler(new TCToForgeEventConverter(), EventPriority.CANCELABLE);
  25. }

代码示例来源:origin: RS485/LogisticsPipes

  1. return;
  2. if(Loader.instance().getConfigDir() == null) {
  3. return;
  4. Configs.CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "LogisticsPipes.cfg"));
  5. Configs.CONFIGURATION.load();
  6. Configs.loaded = true;

相关文章