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


Java Configuration.load方法代码示例

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


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

示例1: init

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

        for (FurnaceType type : FurnaceType.values())
        {
            int speed = config.get("General", type.name().toLowerCase() + "FurnaceSpeed", type.speed).getInt(type.speed);
            float consumptionRate = (float) config.get("General", type.name().toLowerCase() + "FurnaceConsumptionRate", type.consumptionRate).getDouble(type.consumptionRate);

            furanceSpeeds.put(type, speed);
            consumptionRates.put(type, consumptionRate);
        }
    } finally
    {
        config.save();
    }
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:21,代码来源:Config.java

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

示例3: preInit

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event){
    config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();
    COMPASSX_PROPERTY = config.get("hidden", ConfigValues.COMPASSX_NAME, ConfigValues.COMPASSX_DEFAULT, I18n.format(ConfigValues.COMPASSX_NAME+".tooltip"));
    COMPASSY_PROPERTY = config.get("hidden", ConfigValues.COMPASSY_NAME, ConfigValues.COMPASSY_DEFAULT, I18n.format(ConfigValues.COMPASSY_NAME+".tooltip"));
    TARGETX_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETX_NAME, ConfigValues.TARGETX_DEFAULT, I18n.format(ConfigValues.TARGETX_NAME+".tooltip"));
    TARGETZ_PROPERTY = config.get(Configuration.CATEGORY_GENERAL, ConfigValues.TARGETZ_NAME, ConfigValues.TARGETZ_DEFAULT, I18n.format(ConfigValues.TARGETZ_NAME+".tooltip"));
    XALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.XALIGNMENT_NAME, ConfigValues.XALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.XALIGNMENT_NAME+".tooltip"));
    YALIGNMENT_PROPERTY = config.get("hidden", ConfigValues.YALIGNMENT_NAME, ConfigValues.YALIGNMENT_DEFAULT.name(), I18n.format(ConfigValues.YALIGNMENT_NAME+".tooltip"));
    syncConfig();

    GameRegistry.register(uhccompass);
    ModelLoader.setCustomModelResourceLocation(uhccompass, 0, new ModelResourceLocation(MODID+":uhccompass", "inventory"));

    MinecraftForge.EVENT_BUS.register(new ClientEvents());
    MinecraftForge.EVENT_BUS.register(new RenderEvents());
    MinecraftForge.EVENT_BUS.register(keyHandler = new KeyHandler());
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:UHC-Compass,代码行数:20,代码来源:UHCCompass.java

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

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

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

示例7: readMainConfig

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
private static void readMainConfig() {
    Configuration cfg = mainConfig;
    try {
        cfg.load();
        cfg.addCustomCategoryComment(GeneralConfiguration.CATEGORY_GENERAL, "General settings");

        GeneralConfiguration.init(cfg);
    } catch (Exception e1) {
        FMLLog.log(Level.ERROR, e1, "Problem loading config file!");
    } finally {
        if (mainConfig.hasChanged()) {
            mainConfig.save();
        }
    }
}
 
开发者ID:McJty,项目名称:Lector,代码行数:16,代码来源:ConfigSetup.java

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

示例9: preInit

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

    potionTrust = new PotionTrust("trust");

    MinecraftForge.EVENT_BUS.register(new Events());
}
 
开发者ID:Ellpeck,项目名称:TrustCircle,代码行数:11,代码来源:TrustCircle.java

示例10: readConfig

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

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

示例11: readConfig

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

    initGeneralSettings(cfg);
    initMachineSettings(cfg);
    initEffectsSettings(cfg);
}
 
开发者ID:McJty,项目名称:needtobreath,代码行数:8,代码来源:Config.java

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

示例13: initializeConfiguration

import net.minecraftforge.common.config.Configuration; //导入方法依赖的package包/类
public static void initializeConfiguration()
{
	File configFile = new File(Loader.instance().getConfigDir(), VillagerInventoryMod.MODID + ".cfg");
	config = new Configuration(configFile);
	config.load();
	syncConfig(true, true);
}
 
开发者ID:crazysnailboy,项目名称:VillagerInventory,代码行数:8,代码来源:ModConfiguration.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: 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


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