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

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

本文整理了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

/**
 * 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;
}

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

/**
 * 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);
}

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

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

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

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

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

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

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

/**
 * 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);
}

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

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.");
  }
}

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

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

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

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

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

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

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

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

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

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

@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);
}

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

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

相关文章