本文整理汇总了Java中net.minecraftforge.common.Configuration.get方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.get方法的具体用法?Java Configuration.get怎么用?Java Configuration.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.Configuration
的用法示例。
在下文中一共展示了Configuration.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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]);
}
}
}
示例2: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@PreInit
public void preInit(FMLPreInitializationEvent event) {
logger = Logger.getLogger(ID);
logger.setParent(FMLLog.getLogger());
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
post_url = config.get(config.CATEGORY_GENERAL, "post_url", "http://localhost/post/", "This is the url of which the mod posts updates to.").value;
identifier = config.get(config.CATEGORY_GENERAL, "identifier", "knownplayers", "This string determines the value of the id field in the post request.").value;
debug = config.get(Configuration.CATEGORY_GENERAL, "debug", false, "Enable debuging?").getBoolean(true);
event_login = config.get("event", "login", true, "Send POST on player login?").getBoolean(true);
event_logout = config.get("event", "logout", true, "Send POST on player logout?").getBoolean(true);
event_respawn = config.get("event", "respawn", true, "Send POST on player respawn?").getBoolean(true);
event_changedimension = config.get("event", "changedimension", true, "Send POST when player changes world?").getBoolean(true);
config.save();
logger.info("debug: " + debug);
logger.info("identifier: " + identifier);
logger.info("post_url: " + post_url);
logger.info("event_login: " + event_login);
logger.info("event_logout: " + event_logout);
logger.info("event_respawn: " + event_respawn);
logger.info("event_changedimension: " + event_changedimension);
}
示例3: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
config.load();
Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000);
updateI.comment = "Update Interval time for all EntityLiving in milliseconds. The lower the better and costlier.";
updateInterval = updateI.getInt();
itemsMap = new HashMap<Integer, Integer>();
Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50:15,89:12,348:10,91:15,327:15,76:10,331:10,314:14");
itemsList.comment = "Item and Armor IDs that shine light when found on any EntityLiving. Syntax: ItemID:LightValue, seperated by commas";
String[] tokens = itemsList.getString().split(",");
for (String pair : tokens)
{
String[] values = pair.split(":");
int id = Integer.valueOf(values[0]);
int value = Integer.valueOf(values[1]);
itemsMap.put(id, value);
}
config.save();
}
示例4: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
config.load();
Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14");
itemsList.comment = "Item IDs that shine light while held. Armor Items also work when worn. [ONLY ON OTHERS] Syntax: ItemID[-MetaValue]:LightValue, seperated by commas";
itemsMap = new ItemConfigHelper(itemsList.getString(), 15);
Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000);
updateI.comment = "Update Interval time for all other player entities in milliseconds. The lower the better and costlier.";
updateInterval = updateI.getInt();
config.save();
}
示例5: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
config.load();
Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14");
itemsList.comment = "Item IDs that shine light when dropped in the World.";
itemsMap = new ItemConfigHelper(itemsList.getString(), 15);
Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000);
updateI.comment = "Update Interval time for all Item entities in milliseconds. The lower the better and costlier.";
updateInterval = updateI.getInt();
Property notWaterProofList = config.get(Configuration.CATEGORY_GENERAL, "TurnedOffByWaterItems", "50,327");
notWaterProofList.comment = "Item IDs that do not shine light when dropped and in water, have to be present in LightItems.";
notWaterProofItems = new ItemConfigHelper(notWaterProofList.getString(), 1);
config.save();
}
示例6: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
config.load();
Property itemsList = config.get(Configuration.CATEGORY_GENERAL, "LightItems", "50,89=12,348=10,91,327,76=10,331=10,314=14");
itemsList.comment = "Item IDs that shine light while held. Armor Items also work when worn. [ONLY ON YOURSELF]";
itemsMap = new ItemConfigHelper(itemsList.getString(), 15);
Property notWaterProofList = config.get(Configuration.CATEGORY_GENERAL, "TurnedOffByWaterItems", "50,327");
notWaterProofList.comment = "Item IDs that do not shine light when held in water, have to be present in LightItems.";
notWaterProofItems = new ItemConfigHelper(notWaterProofList.getString(), 1);
config.save();
}
示例7: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@PreInit
public void preInit(FMLPreInitializationEvent event) {
// TODO: Read configuration files for blocks and items
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
//someConfigFlag = Boolean.parseBoolean(config.get(ConfigCategory_Generic, "someConfig", "true").value);
config.addCustomCategoryComment(ConfigCategory_Generic, "All generic settings for questcraft");
Property someConfig = config.get(ConfigCategory_Generic, "someConfig", "true");
someConfig.comment = "Configure some configuration setting (true/false). Default true";
someConfigFlag = someConfig.getBoolean(true);
Property questInstanceItemIDProperty = config.get(ConfigCategory_Generic, "quest-instance-item-id", "5000");
questInstanceItemIDProperty.comment = "Item ID used for quest instance items";
questInstanceItemID = questInstanceItemIDProperty.getInt(5000);
config.save();
}
示例8: Metrics
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
public Metrics(final String modname, final String modversion) throws IOException
{
if ((modname == null) || (modversion == null))
{
throw new IllegalArgumentException("modname and modversion cannot be null");
}
this.modname = modname;
this.modversion = modversion;
// load the config
configurationFile = getConfigFile();
configuration = new Configuration(configurationFile);
// Get values, and add some defaults, if needed
configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
configuration.save();
}
示例9: loadConfig
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
public static void loadConfig(Configuration config) {
config.load();
connectURL = config.get("Web", "ConnectURL", "http://mywebserver.info/php/").getString();
rate = config.get("Web", "UploadC", false);
rate.comment = "Upload data by timer/minute(int) or false for logout and itemchange";
if(rate.getBoolean(false) || rate.getInt() < 0){
Refrate = 0;
}
else{
Refrate = rate.getInt();
}
mkT = config.get("Misc", "maketexture", false);
mkT.comment = "Enable the texture interceptor? (make a zip after doing /isl makeT ingame)";
maketexture = mkT.getBoolean(true);
DEBUG = config.get("Misc", "DEBUG", false).getBoolean(true);
ChestUP = config.get("Misc", "ChestUP", false);
ChestUP.comment = "Upload chest contents regardless of signs? (nonfunctional right now)";
uploadchests = ChestUP.getBoolean(true);
config.save();
}
示例10: loadItemsFromConfig
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
public static void loadItemsFromConfig(Configuration config) {
config.addCustomCategoryComment(
"ITEM_PRICES",
"Add here the item prices.\n"
+ "-1 means no price is set.\n"
+ "'item.' signifies an item, 'tile.' signifies a block.");
Property configProperty;
int price;
for (int i = 0; i < Item.itemsList.length; i++) {
if (Item.itemsList[i] == null || isBlacklisted(Item.itemsList[i]))
continue;
Integer defaultPrice = -1;
if (defPrices != null){
defaultPrice = defPrices.get(Item.itemsList[i].itemID);
if (defaultPrice == null){
defaultPrice = -1;
}
}
configProperty = config.get("ITEM_PRICES",
Item.itemsList[i].getUnlocalizedName(), defaultPrice);
price = configProperty.getInt();
if (price != -1) {
addItemToList(Item.itemsList[i], price);
}
}
}
示例11: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
acceleratorID = config.getBlock("acceleratorID", 530).getInt();
launcherID = config.getBlock("launcherID", 531).getInt();
heartSandID = config.getBlock("heartSandID", 532).getInt();
gravityInverterID = config.getBlock("gravityInverterID", 533).getInt();
directionalLauncherID = config.getBlock("directionalLauncherID", 534).getInt();
gravityWellID = config.getBlock("gravityWellID", 535).getInt();
pearlActivatorID = config.getBlock("pearlActivatorID", 536).getInt();
ruggedPearlID = config.getItem("ruggedPearlID", 537).getInt();
gravityNullifierID = config.getBlock("gravityNullifierID", 538).getInt();
negatorID = config.getItem("negatorID", 539).getInt();
detectorID = config.getBlock("detectorID", 540).getInt();
gravityInverterRange = config.get("tweaks", "gravityInverterRange", 8);
gravityWellRange = config.get("tweaks", "gravityWellRange", 16);
gravityWellPower = config.get("tweaks", "gravityWellPower", 100);
detectorRange = config.get("tweaks", "detectorRange", 8);
ruggedPearlLifespan = config.get("tweaks", "ruggedPearlLifespan", 1600);
airResistanceInNullifier = config.get("tweaks", "airResistanceInNullifier", false);
config.save();
}
示例12: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@PreInit
public void preInit(FMLPreInitializationEvent event) {
logger = Logger.getLogger(ID);
logger.setParent(FMLLog.getLogger());
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
// post_url = config.get(config.CATEGORY_GENERAL, "post_url",
// "http://localhost/post/",
// "This is the url of which the mod posts updates to.").value;
identifier = config.get(config.CATEGORY_GENERAL, "identifier", "commandforwarder", "This string determines the value of the id field in the post request.").value;
debug = config.get(Configuration.CATEGORY_GENERAL, "debug", false, "Enable debuging?").getBoolean(true);
ConfigCategory cmdcat = config.getCategory("commands");
cmdcat.setComment("This is a list of command=url.");
Map<String, Property> cmdmap = cmdcat.getValues();
if (cmdmap.isEmpty()) {
config.get("commands", "example", "http://localhost/post/");
}
for (Map.Entry i : cmdmap.entrySet()) {
String k = (String) i.getKey();
Property v = (Property) i.getValue();
Command cmd = new Command(k, v.value);
this.commands.add(cmd);
}
// public Map<String,Property> getValues()
config.save();
logger.info("debug: " + debug);
logger.info("identifier: " + identifier);
// logger.info("post_url: " + post_url);
}
示例13: initConfig
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
private void initConfig(FMLPreInitializationEvent event)
{
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
rendererFormat = config.get(Configuration.CATEGORY_GENERAL, ConfigKeys.format.toString(), Format.Interlaced.toString(),
configComment("sterescopic 3D output format to be used", Format.values()));
swapSides = config.get(Configuration.CATEGORY_GENERAL, ConfigKeys.swapSides.toString(), false,
configComment("whether to swap the left and right image", new Boolean[] { true, false })).getBoolean(false);
if (config.hasChanged()) {
config.save();
}
}
示例14: preInit
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent evt)
{
Configuration config = new Configuration(evt.getSuggestedConfigurationFile());
config.load();
Property updateI = config.get(Configuration.CATEGORY_GENERAL, "update Interval", 1000);
updateI.comment = "Update Interval time for all burning EntityLiving, Arrows and Fireballs in milliseconds. The lower the better and costlier.";
updateInterval = updateI.getInt();
config.save();
}
示例15: loadCommonConfig
import net.minecraftforge.common.Configuration; //导入方法依赖的package包/类
public static void loadCommonConfig(FMLPreInitializationEvent evt)
{
Configuration c = new Configuration(evt.getSuggestedConfigurationFile());
try {
c.load();
hexbiscus = c.getBlock("ID.HexbiscusFlower", 2400);
tribalHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalHelmet", 26200);
tribalChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalChest", 26201);
tribalLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalLeggings", 26202);
tribalShoesId = c.getItem(Configuration.CATEGORY_ITEM, "ID.TribalShoes", 26203);
scaleHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleHelmet", 26204);
scaleChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleChest", 26205);
scaleLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleLeggings", 26206);
scaleBootsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ScaleBoots", 26207);
thiefHelmetId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefHelmet", 26208);
thiefChestId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefChest", 26209);
thiefLeggingsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefLeggings", 26210);
thiefBootsId = c.getItem(Configuration.CATEGORY_ITEM, "ID.ThiefBoots", 26211);
hexicalEssence = c.getItem(Configuration.CATEGORY_ITEM, "ID.HexicalEssence", 26212);
hexicalDiamond = c.getItem(Configuration.CATEGORY_ITEM, "ID.HexicalDiamond", 26213);
dimensionalBlacklist = c.get("World Generation", "Dimensional Blacklist", "");
dimensionalBlacklist.comment = "Comma separated list of all blacklisted dimension IDs";
} catch (Exception e) {
e.printStackTrace();
} finally {
c.save();
}
}