當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。