当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.save方法代码示例

本文整理汇总了Java中net.minecraftforge.common.config.Configuration.save方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.save方法的具体用法?Java Configuration.save怎么用?Java Configuration.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.config.Configuration的用法示例。


在下文中一共展示了Configuration.save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: IGWSupportNotifier

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier() {
    if (FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if (config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for (ModContainer container : loadedMods) {
                if (container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    MinecraftForge.EVENT_BUS.register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:26,代码来源:IGWSupportNotifier.java

示例2: ProspectingConfiguration

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public ProspectingConfiguration(FMLPreInitializationEvent e) {
	final Configuration config = new Configuration(e.getSuggestedConfigurationFile());

	config.load();

	// this.nugget_amount = config.getInt("Nuggets Per Chunk", "General", 1, 0, 999999999, "The number of nuggets that can be prospected in a chunk, if it has applicable ore in it.");
	this.chunk_expiry = config.getInt("Chunk Expiry", "Caching", 300, 1, 999999999, "The number of seconds until a chunk's cache expires. After the cache expires, the chunk will be re-scanned for ore when it is prospected.");

	this.nugget_chance = config.getFloat("Nugget Chance", "Probabilities", 0.8f, 0f, 1f, "The chance that a chunk will have nuggets. The number of nuggets produced is determined by the \"Ore Per Nugget\" setting");
	this.ore_per_nugget = config.getInt("Ore Per Nugget", "Probabilities", 50, 0, 4096, "The number of ore, on average, that will produce 1 nugget in a chunk. For example, if this value is 50, and a chunk has 100 iron ore, you can expect to get 2 nuggets from the chunk through prospecting.");
	this.ore_per_nugget_deviation = config.getInt("Ore Per Nugget Deviation", "Probabilities", 10, 0, 4096, "The maximum deviation for nugget calculations. Your value for \"Ore Per Nugget\" well be randomly modified +- this value when calculating nuggets.");
	this.max_nuggets = config.getInt("Maximum Nugget Count", "Probabilities", 5, 0, 4096, "The maximum number of nuggets to spawn in a given chunk for each ore.");
	this.flower_chance = config.getFloat("Flower Chance", "Probabilities", 0.8f, 0f, 1f, "The chance that a given chunk will produce flowers, if it contains ore. The number of flowers produced is determined by the \"Ore Per Flower\" setting.");
	this.flower_false_chance = config.getFloat("Flower False Positive Chance", "Probabilities", 0.05f, 0f, 1f, "This chance that a chunk will have some indicator flowers spawn despite having no ore.");
	this.ore_per_flower = config.getInt("Ore Per Flower", "Probabilities", 50, 0, 4096, "The number of ore, on average, that it takes to produce 1 flower on the surface.");
	this.ore_per_flower_deviation = config.getInt("Ore Per Flower Deviation", "Probabilities", 10, 0, 4096, "The maximum deviation for flower calculations. Your value for \"Ore Per Flower\" well be randomly modified +- this value when calculating flowers.");
	this.max_flowers = config.getInt("Maximum Flower Count", "Probabilities", 10, 0, 4096, "The maximum number of flowers to spawn in a given chunk for each type of ore.");

	config.save();
}
 
开发者ID:azacock,项目名称:Prospecting,代码行数:21,代码来源:ProspectingConfiguration.java

示例3: preLoad

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@Mod.EventHandler
public void preLoad(FMLPreInitializationEvent event)
{
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();

    config.addCustomCategoryComment("general", "General settings");
    fancyWeightage = config.getInt("fancyWeightage", "general", 80, 0, 100, "Weightage of llamas wearing parts of their outfit, in percentage% (0-100)");
    randomizeParts = config.getInt("randomizeParts", "general", 1, 0, 1, "0 = Render the entire outfit (except disabled parts)\n1 = Randomly choose which parts of the outfit to render (per llama)");
    disabledParts = config.getStringList("disabledParts", "general", disabledParts, "Disable parts of the outfit", new String[] { "hat", "monocle", "pipe", "bowtie", "fez", "moustache" });

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

    MinecraftForge.EVENT_BUS.register(this);
}
 
开发者ID:iChun,项目名称:BetterThanLlamas,代码行数:19,代码来源:BetterThanLlamas.java

示例4: preInit

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {

    Configuration config = new Configuration(new File(e.getModConfigurationDirectory(), "creativezone.cfg"));
    config.load();

    // Check interval (seconds)
    checkInterval = config.getInt("ScanInterval", "config", 1, 1, 60,
            "Sets the interval (in seconds) for scanning player locations");

    // Creative zone radius
    zoneRadius = config.getInt("ZoneRadius", "config", 25, 5, 1000,
            "Sets the radius of the creative zone");

    Property whiteListProp = config.get("config", "Whitelist", new String[0],
            "Gets the list of whitelisted users");
    for (String s : whiteListProp.getStringList()) {
        whitelist.add(s);
    }

    config.save();
}
 
开发者ID:dizzyd,项目名称:creativezone,代码行数:23,代码来源:CreativeZoneMod.java

示例5: initConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void initConfig(File configFile) { // Gets called from preInit
    try {

        // Ensure that the config file exists
        if (!configFile.exists()) configFile.createNewFile();

        // Create the config object
        config = new Configuration(configFile);

        // Load config
        config.load();

        // Read props from config
        Property debugModeProp = config.get(Configuration.CATEGORY_GENERAL, // What category will it be saved to, can be any string
                "debug_mode", // Property name
                "false", // Default value
                "Enable the debug mode (useful for reporting issues)"); // Comment

        DEBUG_MODE = debugModeProp.getBoolean(); // Get the boolean value, also set the property value to boolean
    } catch (Exception e) {
        // Failed reading/writing, just continue
    } finally {
        // Save props to config IF config changed
        if (config.hasChanged()) config.save();
    }
}
 
开发者ID:lukas2005,项目名称:Device-Mod-Apps,代码行数:27,代码来源:ModConfig.java

示例6: handleConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void handleConfig(Configuration config){
	Property current;
	int chunkRange; double maxSpawnTime;
	String[] dimensionArray = {"0"};
	config.load();
	current = config.get(Configuration.CATEGORY_GENERAL, "Logging", false);
	current.setComment("Enable this to receive server messages whenever a villager tries to spawn.  Default false.");
	LOGGING = current.getBoolean();
	current = config.get("SpawnValues", "Chunk check range", 2);
	current.setComment("This is the range in chunks from each player that Emergent Villages checks for valid spawn positions.  Default 2.");
	chunkRange = current.getInt();
	current = config.get("SpawnValues", "Inhabited time for maximum spawn chance", 3600000.0d);
	current.setComment("This is the time in ticks at which the spawn chance for a villager for any given chunk is 100%.  Minecraft increments this timer for each player "
			+ "in a chunk once per tick.  Increase this value for a slower spawn rate, and decrease it for a faster spawn rate.  "
			+ "Default 3600000.0f.");
	maxSpawnTime = current.getDouble();
	current = config.get(Configuration.CATEGORY_GENERAL, "Max villagers per chunk", 1);
	current.setComment("This is the maximum amount of villagers that Emergent Villages spawns per chunk.  Default 1.");
	SpawnHandler.initConfig(chunkRange, current.getInt(), maxSpawnTime);
	current = config.get(Configuration.CATEGORY_GENERAL , "Dimensions", dimensionArray);
	current.setComment("These are the dimensions that Emergent Villages will spawn villagers in.  Default 0 (Overworld).");
	dimensionArray = current.getStringList();
	current = config.get(Configuration.CATEGORY_GENERAL, "Tick speed", 600);
	current.setComment("This is the amount of time that Emergent Villages waits between checks.  Minecraft ticks 20 times per second.  Higher numbers means that even if "
			+ "the regional difficulty is high it will take a while to spawn villagers, but the impact on the server will be low.  Lower numbers means villagers spawn "
			+ "faster, up to the limit, but there will be a performance hit.  Default 600.");
	TickHandler.initConfig(current.getInt(), dimensionArray);
	config.save();
}
 
开发者ID:Edicatad,项目名称:EmergentVillages,代码行数:30,代码来源:ConfigHandler.java

示例7: readConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void readConfig(){
    File regionFolder = new File(DifficultyManager.getConfigDir(),getName());
    File regionConfigFile = new File(regionFolder,"region.cfg");
    File defaultRegionConfigFile = new File(regionFolder,"default.cfg");
    File[] filesInRegion = regionFolder.listFiles();
    List<File> mobConfigFiles = Lists.newArrayList();
    if(filesInRegion!=null) {
        mobConfigFiles.addAll(Arrays.stream(filesInRegion)
                .filter(
                        file -> {
                            return !(file.getName().endsWith("region.cfg") || file.getName().endsWith("default.cfg"));
                        }).collect(Collectors.toList()));
    }
    Configuration regionConfig = new Configuration(regionConfigFile);
    readRegionConfig(regionConfig);
    Configuration defaultConfiguration = new Configuration(defaultRegionConfigFile);
    try {
        defaultConfiguration.load();
        defaultConfig = new RegionMobConfig(defaultConfiguration);
    }finally {
        if(defaultConfiguration.hasChanged()){
            defaultConfiguration.save();
        }
    }

    for(File mobConfigFile : mobConfigFiles){
        String mobId = mobConfigFile.getName();
        mobId = mobId.substring(0,mobId.lastIndexOf("."));
        Configuration config = new Configuration(mobConfigFile);
        try {
            config.load();
            RegionMobConfig mobConfig = new RegionMobConfig(config);
            byMobConfig.put(mobId,mobConfig);
        }finally {
            if(config.hasChanged()){
                config.save();
            }
        }
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:41,代码来源:Region.java

示例8: save

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void save(Configuration config)
{
	if (config.hasChanged())
	{
		config.save();
	}
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:8,代码来源:BBConfig.java

示例9: init

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void init(FMLPreInitializationEvent e) {
	config = new Configuration(e.getSuggestedConfigurationFile());
	config.load();

	stoneballDamage = config.getFloat("stoneballDamage", Configuration.CATEGORY_GENERAL,
			2f, 0f, 4096f, "damage of stone ball");
	metalballDamage = config.getFloat("metalballDamage", Configuration.CATEGORY_GENERAL,
			6f, 0f, 4096f, "damage of metal ball");
	enderballDamage = config.getFloat("enderballDamage", Configuration.CATEGORY_GENERAL,
			10f, 0f, 4096f, "damage of ender ball");

	if (config.hasChanged())
		config.save();
}
 
开发者ID:arucil,项目名称:mc-Slingshot,代码行数:15,代码来源:Config.java

示例10: YouTubeConfiguration

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
private YouTubeConfiguration(File path) {
  config = new Configuration(path);
  config.load();
  addGeneralConfig();
  if (config.hasChanged()) {
    config.save();
  }
}
 
开发者ID:youtube,项目名称:youtube-chat-for-minecraft,代码行数:9,代码来源:YouTubeConfiguration.java

示例11: readConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readConfig() {
	Configuration cfg = CommonProxy.config;
	try {
		cfg.load();
		initGeneralConfig(cfg);
	} catch (Exception exception) {
		TitleChanger.logger.log(Level.ERROR, "Problem loading config file!", exception);
	} finally {
		if (cfg.hasChanged()) {
			cfg.save();
		}
	}
}
 
开发者ID:Maxwell-lt,项目名称:TitleChanger,代码行数:14,代码来源:Config.java

示例12: loadConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void loadConfig(FMLPreInitializationEvent event) {
	
	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
	config.load();
	
	dropRate = config.get("misc", "startingSeedDropRate", 5, "Drop weight for the mod's starting seed. The higher the number, the more often it'll drop.").getInt();
	
	cropNormal = config.get("plants", "canPlantNormieSeeds", true).getBoolean();
	cropPrecision = config.get("plants", "canPlantPrecisionSeeds", true).getBoolean();
	cropDirigible = config.get("plants", "canPlantDirigibleSeeds", true).getBoolean();
	cropWeepingbells = config.get("plants", "canPlantWeepingbellSeeds", true).getBoolean();
	cropKnowledge = config.get("plants", "canPlantKnowledgeSeeds", true).getBoolean();
	cropEnderlily = config.get("plants", "canPlantEnderlilySeeds", true).getBoolean();
	cropMillennium = config.get("plants", "canPlantMillenniumSeeds", true).getBoolean();
	cropMerlinia = config.get("plants", "canPlantMerliniaSeeds", true).getBoolean();
	cropInvisibilia = config.get("plants", "canPlantInvisibiliaSeeds", true).getBoolean();
	cropMusica = config.get("plants", "canPlantMusicaSeeds", true).getBoolean();
	cropFeroxia = config.get("plants", "canPlantFeroxiaSeeds", true).getBoolean();
	cropCinderbella = config.get("plants", "canPlantCinderbellaSeeds", true).getBoolean();
	cropCollis = config.get("plants", "canPlantCollisSeeds", true).getBoolean();
	cropMaryjane = config.get("plants", "canPlantMaryjaneSeeds", true).getBoolean();
	cropEula = config.get("plants", "canPlantEulaSeeds", true).getBoolean();
	cropDyeius = config.get("plants", "canPlantDyeiusSeeds", true).getBoolean();
	cropCobblonia = config.get("plants", "canPlantCobbloniaSeeds", true).getBoolean();
	cropAbstract = config.get("plants", "canPlantAbstractSeeds", true).getBoolean();
	cropWafflonia = config.get("plants", "canPlantCliqiaSeeds", true).getBoolean();
	cropDevilsnare = config.get("plants", "canPlantDevilSnare", true).getBoolean();
	cropPixelsius = config.get("plants", "canPlantPixelsius", true).getBoolean();
	cropArtisia = config.get("plants", "canPlantArtisia", true).getBoolean();
	cropMalleatoris = config.get("plants", "canPlantMalleatoris", true).getBoolean();
	cropPetramia = config.get("plants", "canPlantPetramia", true).getBoolean();
	
	config.save();
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:35,代码来源:UCConfig.java

示例13: call

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@Override
public Void call() throws Exception {
    File file = new File("envcheck");
    if (!file.exists()) {
        file.mkdir();
    }

    Configuration config = new Configuration(new File(new File("config"), "envcheck.cfg"));
    showForgeTransformers = config.getBoolean("showForgeTransformers", "asmTransformerChanges", false, "Whether or not to show the changes done by Forge's own transformers.");;
    config.save();

    wrapTransformers();

    return null;
}
 
开发者ID:asiekierka,项目名称:EnvironmentCheckerMC,代码行数:16,代码来源:EnvCheckCore.java

示例14: readConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readConfig() {
	Configuration cfg = Etheric.config;
	try {
		cfg.load();
		initGeneralConfig(cfg);
	} catch (Exception e1) {

	} finally {
		if (cfg.hasChanged()) {
			cfg.save();
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:14,代码来源:Config.java

示例15: readConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readConfig() {
    Configuration cfg = CommonProxy.config;
    try {
        cfg.load();
        initGeneralConfig(cfg);
        initPermissionConfig(cfg);
    } catch (Exception e1) {
        MeeCreeps.logger.log(Level.ERROR, "Problem loading config file!", e1);
    } finally {
        if (cfg.hasChanged()) {
            cfg.save();
        }
    }
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:15,代码来源:Config.java


注:本文中的net.minecraftforge.common.config.Configuration.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。