當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration類代碼示例

本文整理匯總了Java中net.minecraftforge.common.Configuration的典型用法代碼示例。如果您正苦於以下問題:Java Configuration類的具體用法?Java Configuration怎麽用?Java Configuration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Configuration類屬於net.minecraftforge.common包,在下文中一共展示了Configuration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preInit

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
/**
 * Set the ids in the configs
 * @param event
 */
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	config = new Configuration(event.getSuggestedConfigurationFile());

	try {
		config.load();

		bedBlockID = config.getBlock("Guest Bed Block ID", bedBlockID).getInt(2000);

		bedItemID = config.getItem("Guest Bed Item ID", bedItemID).getInt(14000);
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		config.save();
	}
}
 
開發者ID:Cojomax99,項目名稱:GuestBeds,代碼行數:21,代碼來源:GuestBedsMod.java

示例2: buildBlacklist

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public static void buildBlacklist(Configuration config) {
	config.addCustomCategoryComment(
			"ITEM_BLACKLIST",
			"Add here the blacklisted items (set them to true).\n"
					+ "'item.' signifies an item, 'tile.' signifies a block.\n"
					+ "Everytime this is changed, you probably should delete the price file.\n"
					+ "(although this is not necessary.)");
	Property configProperty;
	for (int i = 0; i < Item.itemsList.length; i++) {
		if (Item.itemsList[i] == null)
			continue;
		Boolean isBlackListed = false;
		if (defBlacklist != null){
			isBlackListed = defBlacklist.get(Item.itemsList[i].itemID);
			if (isBlackListed == null){
				isBlackListed = false;
			}
		}
		configProperty = config.get("ITEM_BLACKLIST",
				Item.itemsList[i].getUnlocalizedName(), isBlackListed);
		if (configProperty.getBoolean(false)) {
			addItemToBlacklist(Item.itemsList[i]);
		}
	}
}
 
開發者ID:TED-996,項目名稱:UniversalCoinsMod,代碼行數:26,代碼來源:UCItemPricer.java

示例3: preInit

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	
	Configuration config = new Configuration(
			event.getSuggestedConfigurationFile());
	
	config.load();
	itemCoinID = config.getItem("itemCoin", itemCoinID).getInt();
	itemSSTackID = config.getItem("itemSmallCoinStack", itemSSTackID).getInt();
	itemLStackID = config.getItem("itemLargeCoinStack", itemLStackID).getInt();
	itemHeapID = config.getItem("itemCoinHeap", itemHeapID).getInt();
	itemSellerID = config.getItem("itemSeller", itemSellerID).getInt();
	
	blockTradeStationID = config.getBlock("blockTradeStation", blockTradeStationID).getInt();
	config.save();
}
 
開發者ID:TED-996,項目名稱:UniversalCoinsMod,代碼行數:17,代碼來源:UniversalCoins.java

示例4: loadConfig

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
/**
 * Loads configurations from the properties file.<br>
 * - Remote item ID: (Remote.ID)<br>
 */
private static void loadConfig() {
    Configuration wirelessconfig = ConfigurationLib.getConfig();

    wirelessconfig.load();

    remoteID = wirelessconfig.get(Configuration.CATEGORY_ITEM,
                                  ItemLib.REMOTE,
                                  remoteID).getInt();
    duraTogg = wirelessconfig.get(Configuration.CATEGORY_GENERAL,
                                  "Duration Toggle",
                                  duraTogg).getBoolean(duraTogg);
    pulseTime = wirelessconfig.get(Configuration.CATEGORY_GENERAL,
                                   "Pulse Time",
                                   pulseTime).getInt();
    maxPulseThreads = wirelessconfig.get(Configuration.CATEGORY_GENERAL,
                                         "Max Threads",
                                         maxPulseThreads).getInt();
    wirelessconfig.save();
}
 
開發者ID:SlimeVoid,項目名稱:WirelessRedstone-Addons,代碼行數:24,代碼來源:WRemoteCore.java

示例5: init

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public static void init(File file)
{
    Configuration config = new Configuration(file);
        config.load();
        
        /** Tooltip Sector **/ 
        config.addCustomCategoryComment("Tooltip Options", "These are the options used to control how WikiLink displays tooltips on items when hovering over them in the inventory.");
            includeTooltipsOnItems = config.get("Tooltip Options", "includeTooltipsOnItems", true).getBoolean(true);
       
        /** Link Selection Sector **/
        config.addCustomCategoryComment("Link Selection", "These are the options used to control the different links that appear inside of the WikiLink Menu.");
            enableWiki = config.get("Link Selection", "enableWiki", true).getBoolean(true);
            enableGoogle = config.get("Link Selection", "enableGoogle", true).getBoolean(true);
            enableThread = config.get("Link Selection", "enableThread", true).getBoolean(true);
            enableWebsite = config.get("Link Selection", "enableWebsite", true).getBoolean(true);
            enableYoutube = config.get("Link Selection", "enableYoutube", true).getBoolean(true);
            enableSummarize = config.get("Link Selection", "enableSummarize", true).getBoolean(true);
            
        /** Link Shortener Sector **/
        config.addCustomCategoryComment("Link Shortener Options", "These are the options to change how WikiLink shortens all of it's hyperlinks.");
            shortenHyperlinks = config.get("Link Shortener Options", "shortenHyperlinks", true, "Use bit.ly to shorten links generated by WikiLink").getBoolean(true);
        
        debugMode = config.get("Debug Options", "debugMode", false, "Use this during startup/runtime to get your console spammed curtosy of WikiLink :)").getBoolean(false);    
            
        config.save();
}
 
開發者ID:ElConquistador,項目名稱:WikiLink,代碼行數:27,代碼來源:ConfigHandler.java

示例6: readConfig

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
/**
* Reads the config file.  If it does not exist it is created.  If properties
* do not exist, they are created.
*/
  public static void readConfig(){
ShoulderCamera.SHOULDER_ROTATION     = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderCamera.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderCamera.SHOULDER_ROTATION);
ShoulderCamera.SHOULDER_ZOOM_MOD     = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset"    , ShoulderCamera.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderCamera.SHOULDER_ZOOM_MOD);
ShoulderSettings.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited"    , ShoulderSettings.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderSettings.IS_ROTATION_UNLIMITED);
ShoulderSettings.ROTATION_MAXIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum"    , ShoulderSettings.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderSettings.ROTATION_MAXIMUM);
ShoulderSettings.ROTATION_MINIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum"    , ShoulderSettings.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderSettings.ROTATION_MINIMUM);
ShoulderSettings.IS_ZOOM_UNLIMITED     = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited"    , ShoulderSettings.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderSettings.IS_ZOOM_UNLIMITED);
ShoulderSettings.ZOOM_MAXIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum"    , ShoulderSettings.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderSettings.ZOOM_MAXIMUM);
ShoulderSettings.ZOOM_MINIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum"    , ShoulderSettings.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderSettings.ZOOM_MINIMUM);
ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT  = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair"    , ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT);
ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE  = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther"    , ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE);
ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA  = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead"    , ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA);
  	
  	config.save();
  }
 
開發者ID:sabarjp,項目名稱:ShoulderSurfing,代碼行數:20,代碼來源:ShoulderSurfing.java

示例7: readConfig

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
/**
* Reads the config file.  If it does not exist it is created.  If properties
* do not exist, they are created.
*/
  public static void readConfig(){
  	ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED = config.get(Configuration.CATEGORY_GENERAL, "isCrosshairDynamic"    , ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED, "If enabled, then the crosshair moves around to line up with the block you are facing.").getBoolean(ShoulderSettings.IS_DYNAMIC_CROSSHAIR_ENABLED);
ShoulderCamera.SHOULDER_ROTATION     = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderCamera.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderCamera.SHOULDER_ROTATION);
ShoulderCamera.SHOULDER_ZOOM_MOD     = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset"    , ShoulderCamera.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderCamera.SHOULDER_ZOOM_MOD);
ShoulderSettings.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited"    , ShoulderSettings.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderSettings.IS_ROTATION_UNLIMITED);
ShoulderSettings.ROTATION_MAXIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum"    , ShoulderSettings.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderSettings.ROTATION_MAXIMUM);
ShoulderSettings.ROTATION_MINIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum"    , ShoulderSettings.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderSettings.ROTATION_MINIMUM);
ShoulderSettings.IS_ZOOM_UNLIMITED     = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited"    , ShoulderSettings.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderSettings.IS_ZOOM_UNLIMITED);
ShoulderSettings.ZOOM_MAXIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum"    , ShoulderSettings.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderSettings.ZOOM_MAXIMUM);
ShoulderSettings.ZOOM_MINIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum"    , ShoulderSettings.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderSettings.ZOOM_MINIMUM);
ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT  = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair"    , ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderSettings.TRACE_TO_HORIZON_LAST_RESORT);
ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE  = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther"    , ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderSettings.USE_CUSTOM_RAYTRACE_DISTANCE);
ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA  = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead"    , ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderSettings.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA);
  	
  	config.save();
  }
 
開發者ID:sabarjp,項目名稱:ShoulderSurfing,代碼行數:21,代碼來源:ShoulderSurfing.java

示例8: readConfig

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
/**
* Reads the config file.  If it does not exist it is created.  If properties
* do not exist, they are created.
*/
  public static void readConfig(){
ShoulderHelper.SHOULDER_ROTATION     = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationOffset", ShoulderHelper.SHOULDER_ROTATION, "Third person camera rotation").getDouble((double)ShoulderHelper.SHOULDER_ROTATION);
ShoulderHelper.SHOULDER_ZOOM_MOD     = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomOffset"    , ShoulderHelper.SHOULDER_ZOOM_MOD, "Third person camera zoom").getDouble((double)ShoulderHelper.SHOULDER_ZOOM_MOD);
ShoulderHelper.IS_ROTATION_UNLIMITED = config.get(Configuration.CATEGORY_GENERAL, "isRotationUnlimited"    , ShoulderHelper.IS_ROTATION_UNLIMITED, "Whether or not rotation adjustment has limits").getBoolean(ShoulderHelper.IS_ROTATION_UNLIMITED);
ShoulderHelper.ROTATION_MAXIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMaximum"    , ShoulderHelper.ROTATION_MAXIMUM, "If rotation is limited this is the maximum amount").getDouble((double)ShoulderHelper.ROTATION_MAXIMUM);
ShoulderHelper.ROTATION_MINIMUM      = (float) config.get(Configuration.CATEGORY_GENERAL, "rotationMinimum"    , ShoulderHelper.ROTATION_MINIMUM, "If rotation is limited this is the minimum amount").getDouble((double)ShoulderHelper.ROTATION_MINIMUM);
ShoulderHelper.IS_ZOOM_UNLIMITED     = config.get(Configuration.CATEGORY_GENERAL, "isZoomUnlimited"    , ShoulderHelper.IS_ZOOM_UNLIMITED, "Whether or not zoom adjustment has limits").getBoolean(ShoulderHelper.IS_ZOOM_UNLIMITED);
ShoulderHelper.ZOOM_MAXIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMaximum"    , ShoulderHelper.ZOOM_MAXIMUM, "If zoom is limited this is the maximum amount").getDouble((double)ShoulderHelper.ZOOM_MAXIMUM);
ShoulderHelper.ZOOM_MINIMUM          = (float) config.get(Configuration.CATEGORY_GENERAL, "zoomMinimum"    , ShoulderHelper.ZOOM_MINIMUM, "If zoom is limited this is the minimum amount").getDouble((double)ShoulderHelper.ZOOM_MINIMUM);
ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT  = config.get(Configuration.CATEGORY_GENERAL, "alwaysHaveCrosshair"    , ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT, "Whether or not to show a crosshair in the center of the screen if nothing is in range of you").getBoolean(ShoulderHelper.TRACE_TO_HORIZON_LAST_RESORT);
ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE  = config.get(Configuration.CATEGORY_GENERAL, "showCrosshairFarther"    , ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE, "Whether or not to show the crosshairs farther than normal").getBoolean(ShoulderHelper.USE_CUSTOM_RAYTRACE_DISTANCE);
ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA  = config.get(Configuration.CATEGORY_GENERAL, "keepCameraOutOfHead"    , ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA, "Whether or not to hide the player model if the camera gets too close to it").getBoolean(ShoulderHelper.HIDE_PLAYER_IF_TOO_CLOSE_TO_CAMERA);
  	
  	config.save();
  }
 
開發者ID:sabarjp,項目名稱:ShoulderSurfing,代碼行數:20,代碼來源:ShoulderSurfing.java

示例9: ConfigurationHandler

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public ConfigurationHandler(File file) {
    this.config = new Configuration(file);

    try{
 	   config.load();
 	   
		   config.addCustomCategoryComment("ModSettings", "Here you can change what the mod loads");
		   
		   Constants.DEF_DARKLOAD = config.get("ModSettings", "DarkElements", false, "Toggles the Dark Elemental Load").getBoolean(false);
		   Constants.DEF_DPARTICLESLOAD = config.get("ModSettings", "DarkParticles", true, "Toggles the Dark Particles Load").getBoolean(true);
		   Constants.DEF_HEALING = config.get("ModSettings", "Healing", false, "Toggles the Healing ability of ALL Zero Quest tameable creatures").getBoolean(false);
 	   
    }
    catch(Exception e){
 	   L.log(Level.SEVERE, "Zero Quest encounted a problem while loading the config file: ", e);
    }
    finally{
 	   config.save();
    }
    
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:22,代碼來源:ConfigurationHandler.java

示例10: preInit

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
@EventHandler 
  public void preInit(FMLPreInitializationEvent event) {
  	Configuration config = new Configuration(
		event.getSuggestedConfigurationFile());
config.load();
	betterhopperid = config.getBlock("BetterHopper", 2800).getInt();
	fasterhopperid = config.getBlock("FasterHopper", 2801).getInt();
	biggerhopperid = config.getBlock("BiggerHopper", 2802).getInt();
	strongerhopperid = config.getBlock("StrongerHopper", 2803).getInt();
	fasterstrongerhopperid = config.getBlock("FasterStrongerHopper", 2804).getInt();
	fasterbiggerhopperid = config.getBlock("FasterBiggerHopper", 2805).getInt();
	biggerstrongerhopperid = config.getBlock("BiggerStrongerHopper", 2806).getInt();
	fasterbiggerstrongerhopperid = config.getBlock("FasterBiggerStrongerHopper", 2807).getInt();
	config.addCustomCategoryComment("Enable", "Enable/Disable");
	enableBetterHopper = config.get("Enable", "BetterHopper", true).getBoolean(true);
    enableFasterHopper = config.get("Enable", "FasterHopper", true).getBoolean(true);
    enableBiggerHopper = config.get("Enable", "BiggerHopper", true).getBoolean(true);
    enableStrongerHopper = config.get("Enable", "StrongerHopper", true).getBoolean(true);
config.save();
  }
 
開發者ID:Sudwood,項目名稱:BetterHoppers,代碼行數:21,代碼來源:BetterHoppers.java

示例11: preInit

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
@PreInit
public void preInit(FMLPreInitializationEvent event) {
    apLogger.setParent(FMLLog.getLogger());

    apLogger.info("[Apocalyptic] Starting pre-initialization");
    apLogger.info("[Apocalyptic] Loading configuration");

    isServer = event.getSide().isServer();

    Configuration config = new Configuration(event.getSuggestedConfigurationFile());

    tePerChunk = config.get("general", "TileEntitiesPerChunk", 900).getInt(900);
    silverfishChance = config.get("general", "SilverfishSpawnChance", 0.001).getDouble(0.001);
    transferLimit = config.get("transfer", "limit", new String[]{"0:0:0", "1:X:1"}).getStringList();
    transferTagRemove = config.get("transfer", "tag-remove", new String[]{"0:0", "1:X"}).getStringList();
    //databaseURL = config.get("database", "URL", "jdbc:mysql://site.ru:3306/database").getString();
    //databaseUsername = config.get("database", "Username", "Username").getString();
    //databasePassword = config.get("database", "Password", "Password").getString();

    config.load();
    config.save();
    
    this.initCustomPotions(event);

    apLogger.info("[Apocalyptic] Pre-initialization completed");
}
 
開發者ID:kunik-ru,項目名稱:Apocalyptic,代碼行數:27,代碼來源:Apocalyptic.java

示例12: preInit

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	saveDat = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/savedInv.dat");
	create(saveDat);
       recipeDat = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/savedRecipe.dat");
       create(recipeDat);

       GameRegistry.registerPlayerTracker(new PlayerTracker());

       //Config
       File configFile = new File(event.getSuggestedConfigurationFile().getParentFile().getAbsolutePath() + "/" + MODID + "/specificInventory.cfg");
       create(configFile);

       Configuration config = new Configuration(configFile);
       config.load();
       canModify = config.get("canModify", "general", false, "Can modify starting inventory.").getBoolean(false);
       freshInventory = config.get("replaceInventory","general",false, "true = replaces entire inventory. false = add items to inventory.").getBoolean(false);
       config.save();
}
 
開發者ID:wyldmods,項目名稱:SpecificInventory,代碼行數:21,代碼來源:SpecificInventory.java

示例13: init

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public static void init(File configFile)
{
    configuration = new Configuration(configFile);

    try
    {
        ItemIds.MODULE = configuration.getItem(Strings.MODULE_BASE_NAME, ItemIds.MODULE_DEFAULT).getInt(ItemIds.MODULE_DEFAULT);
        ItemIds.BUDDY = configuration.getItem(Strings.BUDDY_NAME, ItemIds.BUDDY_DEFAULT).getInt(ItemIds.BUDDY_DEFAULT);
        ItemIds.CHIPSET = configuration.getItem(Strings.CHIPSET_BASE_NAME, ItemIds.CHIPSET_DEFAULT).getInt(ItemIds.CHIPSET_DEFAULT);
        ItemIds.ROBOT = configuration.getItem(Strings.ROBOT_NAME, ItemIds.ROBOT_DEFAULT).getInt(ItemIds.ROBOT_DEFAULT);

        BlockIds.FACTORY_CONTROLLER = configuration.getBlock(Strings.FACTORY_CONTROLLER_NAME, BlockIds.FACTORY_CONTROLLER_DEFAULT).getInt(BlockIds.FACTORY_CONTROLLER_DEFAULT);
        BlockIds.FACTORY_BASE = configuration.getBlock(Strings.FACTORY_BASE_NAME, BlockIds.FACTORY_BASE_DEFAULT).getInt(BlockIds.FACTORY_BASE_DEFAULT);
        BlockIds.FACTORY_ENERGY = configuration.getBlock(Strings.FACTORY_ENERGY_NAME, BlockIds.FACTORY_ENERGY_DEFAULT).getInt(BlockIds.FACTORY_ENERGY_DEFAULT);
    } catch (Exception e)
    {
        FMLLog.log(Level.SEVERE, e, Reference.MOD_NAME
                + " has had a problem loading its configuration");
    } finally
    {
        configuration.save();
    }
}
 
開發者ID:PaleoCrafter,項目名稱:R0b0ts,代碼行數:24,代碼來源:ConfigurationHandler.java

示例14: loadConfig

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public static void loadConfig(FMLPreInitializationEvent event) {
	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
	
	config.load();
	
	teamSelectionId = config.getBlock("teamSelectionBlock", 500).getInt();
	unbreakableGlassId = config.getBlock("unbreakableGlass", 501).getInt();
	
	gameMod = config.get(Configuration.CATEGORY_GENERAL, "gameMod", "onlinefreak").getString();
	dimensionId = config.get(Configuration.CATEGORY_GENERAL, "dimensionId", 5).getInt();
	maxTeams = config.get(Configuration.CATEGORY_GENERAL, "maxTeams", 7).getInt();
	
	pvpPreventionMinutes = config.get(Configuration.CATEGORY_GENERAL, "pvpPreventionMinutes", 30).getInt();
	pvpFriendlyFireOn = config.get("PVP", "pvpFriendlyFireOn", false).getBoolean(false);
	
	if (pvpPreventionMinutes < 0)
		pvpPreventionMinutes = 0;
	
	config.save();
}
 
開發者ID:becelot,項目名稱:TeamCore,代碼行數:21,代碼來源:TeamConfig.java

示例15: init

import net.minecraftforge.common.Configuration; //導入依賴的package包/類
public static void init(final File suggestedConfigurationFile)
{
    ConfigHandler.configuration = new Configuration(suggestedConfigurationFile);

    try
    {
        ConfigHandler.configuration.load();

    }
    catch (final Exception ex)
    {
        Agriculture.instance.getLogger().warning("Could not load configurations. Reason" + ex.getMessage());
    }
    finally
    {
        if (ConfigHandler.configuration.hasChanged())
        {
            ConfigHandler.configuration.save();
        }
    }
}
 
開發者ID:TeamMetallurgy,項目名稱:Agriculture,代碼行數:22,代碼來源:ConfigHandler.java


注:本文中的net.minecraftforge.common.Configuration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。