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


Java Configuration.hasChanged方法代码示例

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


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

示例1: load

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

    ARM_CYCLES_PER_TICK = cfg.get(
            "arm", "cyclesPerTick", new int[]{1000, 5000, 25000},
            "CPU cycles per Minecraft tick. Default values: 1000, 5000, 25000 (20 kHz, 100 kHz, 500 kHz)",
            1, Config.ARM_MAX_CYCLES_PER_TICK, true, 3).getIntList();

    ARM_MAX_MEMORY = cfg.get(
            "arm", "maxMemory", 4 * 1024 * 1024,
            "Max memory allowed to be used by CPU. Default value: 4 MiB",
            0, Config.ARM_MAX_MAX_MEMORY).getInt();

    if (cfg.hasChanged()) {
        cfg.save();
    }
}
 
开发者ID:LeshaInc,项目名称:openarch,代码行数:18,代码来源:Config.java

示例2: readConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
/**
 * Accesses config field from CommonProxy and loads data to the static fields in this class
 */
public static void readConfig() {
	Configuration cfg = CommonProxy.config;
	try {
		cfg.load();
		initGeneralConfig(cfg);
		initProtectionConfig(cfg);
		initAreaProtConfig(cfg);
	} catch (Exception exception) {
		MobBlocker.logger.log(Level.ERROR, "Problem loading config file!", exception);
	} finally {
		if (cfg.hasChanged()) {
			cfg.save();
		}
	}
}
 
开发者ID:Maxwell-lt,项目名称:MobBlocker,代码行数:19,代码来源:Config.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: setup

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void setup(Configuration configFile)
{
    genCrystalRock = loadCrystal(configFile, "Rock", new String[]{"-1", "1"}, false);
    genCrystalSea = loadCrystal(configFile, "Sea", new String[]{"-1", "1"}, false);
    genCrystalFlame = loadCrystal(configFile, "Flame", new String[]{"-1"}, true);
    genCrystalAir = loadCrystal(configFile, "Air", new String[]{"-1", "1"}, false);
    genCrystalVision = loadCrystal(configFile, "Vision", new String[]{"1"}, true);
    genCrysagnetite = loadOre(configFile, "Crysagnetite", 15, 25, 1, 3, 1, 2, 0.1f, new String[]{"-1", "1"}, false);
    genCrystallizedRedstone = loadOreOnOre(configFile, "Crystallized Redstone", 0, 16, 0.03f, new String[]{"-1", "1"}, false);
    genCrystallizedGlowstone = loadOreOnOre(configFile, "Crystallized Glowstone", 4, 123, 0.03f, new String[]{"-1"}, true);
    genLabSmall = loadStructure(configFile, "Small Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
    genLabMedium = loadStructure(configFile, "Medium Laboratory", 0.0007f, 15, 256, new String[]{"-1", "1"}, false);
    genBrulantaFlower = loadGround(configFile, "Brulanta Flower", 3, 256, 0, 4, 0.1f, new String[]{"-1", "1"}, false);
    debugMessages = configFile.getBoolean("Debug", GENERAL, false, "Enables or disables the debug logger.");
    animateIfTabletPageTransition = configFile.getBoolean("Animate IF Tablet page transitions", CLIENT, true, "");
    testItem = configFile.getBoolean("Test Item", CLIENT, false, "Enables or disables the test item made for messing with models.");

    if (configFile.hasChanged())
        configFile.save();
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:21,代码来源:PMConfig.java

示例5: preInit

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

    canBeDeactivated = config.getBoolean("canBeDeactivated", Configuration.CATEGORY_GENERAL, true, "If the wopper can be deactivated using redstone");
    wopperSpeed = config.getInt("speed", Configuration.CATEGORY_GENERAL, 10, 1, 1000, "The amount of ticks that have to pass before the wopper does a movement action again");

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

    blockWopper = new BlockWopper("wopper");
    GameRegistry.registerTileEntity(TileEntityWopper.class, MOD_ID+":wopper");

    proxy.preInit();
}
 
开发者ID:Ellpeck,项目名称:Wopper,代码行数:18,代码来源:Wopper.java

示例6: 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

示例7: readConfig

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

示例8: 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

示例9: preInit

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void preInit()
{
	// load the configuration options from a file, if present
	File configFile = new File(Loader.instance().getConfigDir(), CombinedPotions.MODID + ".cfg");
	Configuration config = new Configuration(configFile);
	config.load();

	// set the variables to the configuration values
	maxPotionEffects = config.get(Configuration.CATEGORY_GENERAL, "maxPotionEffects", DefaultValues.maxPotionEffects, "Maximum number of potion effects that can be applied to a single item. Use -1 for no limit.").getInt();

	// save the configuration if it's changed
	if (config.hasChanged()) config.save();
}
 
开发者ID:crazysnailboy,项目名称:CombinedPotions,代码行数:14,代码来源:ModConfiguration.java

示例10: loadFrom

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void loadFrom(File file) {
    lastReadFile = file;
    lastReadConfig = new Configuration(file);

    load();

    if(lastReadConfig.hasChanged()) {
        lastReadConfig.save();
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:11,代码来源:Config.java

示例11: 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

示例12: preInit

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void preInit(FMLPreInitializationEvent event)
{
	// Handle configuration
	File configDir = event.getModConfigurationDirectory();
	config = new Configuration(new File(configDir.getPath(), "simplechunks.cfg"));
	try
	{
		config.load();

		GeneralConfig.readConfig(config);
	}
	catch (Exception e)
	{
		SimpleChunks.logger.error("Error loading config file!", e);
	}
	finally
	{
		if (config.hasChanged())
		{
			config.save();
		}
	}

	// Integrate with other mods
	if (Loader.isModLoaded("theoneprobe"))
	{
		TOPCompat.register();
	}

	// Register chunkloading callback
	ForgeChunkManager.setForcedChunkLoadingCallback(SimpleChunks.instance, new ChunkLoadingHandler());
}
 
开发者ID:DarkMorford,项目名称:Simple-Chunks,代码行数:33,代码来源:CommonProxy.java

示例13: readcfg

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void readcfg(){
	Configuration cfg=CommonProxy.config;
	try{
		cfg.load();
		initConfig(cfg);
	} catch(Exception e){
		System.out.println("Charcoal Pit mod could not load configs");
	} finally{
		if(cfg.hasChanged()){
			cfg.save();
		}
	}
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:14,代码来源:Config.java

示例14: 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

示例15: setupInit

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public void setupInit(Configuration configFile)
{
    for(Map.Entry<ResourceLocation, IExpression> expr : PurMag.INSTANCE.getExpressionRegistry().getRegistry().getEntries())
    {
        boolean bool = configFile.getBoolean(expr.getKey().toString(), EXPRESSIONS, expr.getValue().enabledByDefault(), expr.getValue().getDescription());
        if(bool)
            enabledExpressions.add(expr.getKey());
    }

    if (configFile.hasChanged())
        configFile.save();
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:13,代码来源:PMConfig.java


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