本文整理汇总了Java中net.minecraftforge.common.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于net.minecraftforge.common包,在下文中一共展示了Property类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildBlacklist
import net.minecraftforge.common.Property; //导入依赖的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.Property; //导入依赖的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();
}
示例3: preInit
import net.minecraftforge.common.Property; //导入依赖的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();
}
示例4: preInit
import net.minecraftforge.common.Property; //导入依赖的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();
}
示例5: preInit
import net.minecraftforge.common.Property; //导入依赖的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();
}
示例6: preInit
import net.minecraftforge.common.Property; //导入依赖的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();
}
示例7: init
import net.minecraftforge.common.Property; //导入依赖的package包/类
public static void init(CellariumConfiguration main)
{
Property bloodHelmetId = main.getItem("bloodHelmet.id", DefaultProps.BLOOD_HELMET);
Property bloodChestId = main.getItem("bloodChest.id", DefaultProps.BLOOD_CHEST);
Property bloodPantsId = main.getItem("bloodPants.id", DefaultProps.BLOOD_PANTS);
Property bloodBootsId = main.getItem("bloodBoots.id", DefaultProps.BLOOD_BOOTS);
bloodHelmet = new BloodArmor(bloodHelmetId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 0, "bloodHelmet", "blood");
bloodChest = new BloodArmor(bloodChestId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 1, "bloodChest", "blood");
bloodPants = new BloodArmor(bloodPantsId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 2, "bloodPants", "blood");
bloodBoots = new BloodArmor(bloodBootsId.getInt(), bloodMaterial, Cellarium.proxy.addArmor("blood"), 3, "bloodBoots", "blood");
Property tearsHelmetId = main.getItem("tearsHelmet.id", DefaultProps.TEARS_HELMET);
Property tearsChestId = main.getItem("tearsChest.id", DefaultProps.TEARS_CHEST);
Property tearsPantsId = main.getItem("tearsPants.id", DefaultProps.TEARS_PANTS);
Property tearsBootsId = main.getItem("tearsBoots.id", DefaultProps.TEARS_BOOTS);
tearsHelmet = new TearsArmor(tearsHelmetId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 0, "tearsHelmet", "tears");
tearsChest = new TearsArmor(tearsChestId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 1, "tearsChest", "tears");
tearsPants = new TearsArmor(tearsPantsId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 2, "tearsPants", "tears");
tearsBoots = new TearsArmor(tearsBootsId.getInt(),tearsMaterial, Cellarium.proxy.addArmor("tears"), 3, "tearsBoots", "tears");
}
示例8: loadItemsFromConfig
import net.minecraftforge.common.Property; //导入依赖的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);
}
}
}
示例9: preInit
import net.minecraftforge.common.Property; //导入依赖的package包/类
@Mod.EventHandler
public void preInit( FMLPreInitializationEvent event )
{
// Load config
Configuration config = new Configuration( event.getSuggestedConfigurationFile() );
config.load();
// Setup blocks
Property prop = config.getBlock("billundBlockID", 2642);
prop.comment = "The Block ID for Billund Blocks";
billundBlockID = prop.getInt();
// Setup items
prop = config.getItem("brickItemID", 6242);
prop.comment = "The Item ID for Billund Bricks";
brickItemID = prop.getInt();
prop = config.getItem("orderFormItemID", 6242);
prop.comment = "The Item ID for Billund order forms";
orderFormItemID = prop.getInt();
// Setup general
// None
// Save config
config.save();
proxy.preLoad();
}
示例10: preInit
import net.minecraftforge.common.Property; //导入依赖的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);
}
示例11: preInit
import net.minecraftforge.common.Property; //导入依赖的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();
}
示例12: loadConfiguration
import net.minecraftforge.common.Property; //导入依赖的package包/类
public void loadConfiguration()
{
config.load();
Property blockEngineId = config.get("block", "electricEngine", 765);
Property blockPneumaticGeneratorId = config.get("block", "pneumaticGenerator", 766);
Property itemHighThroughputPowerPipe = config.get("item", "highThroughputPowerPipe", 22552);
Property gregtechRecipes = config.get("recipes", "gregtechRecipes", true);
engineId = blockEngineId.getInt();
pneumaticGeneratorId = blockPneumaticGeneratorId.getInt();
highThroughputPowerPipeId = itemHighThroughputPowerPipe.getInt();
gregtechSupport = gregtechRecipes.getBoolean(true);
config.save();
}
示例13: preInit
import net.minecraftforge.common.Property; //导入依赖的package包/类
@PreInit
public void preInit(FMLPreInitializationEvent event) {
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
FMLLog.log(Level.FINE, "PlaceholderBlocks loading config");
try {
cfg.load();
ConfigCategory category = cfg.getCategory("Blocks");
for (Map.Entry<String, Property> entry : category.entrySet()) {
String key = entry.getKey();
Property property = entry.getValue();
if (property.getString().length() == 0) {
// not set
continue;
}
// parse configuration entry
AbstractBlock abstractBlock = new AbstractBlock(key, property.getString());
// add to list keyed by block ID
List<AbstractBlock> list;
if (abstractBlocks.containsKey(abstractBlock.id)) {
list = abstractBlocks.get(abstractBlock.id);
} else {
list = new ArrayList<AbstractBlock>();
}
list.add(abstractBlock);
abstractBlocks.put(abstractBlock.id, list);
}
} catch (Exception e) {
FMLLog.log(Level.SEVERE, e, "PlaceholderBlocks had a problem loading it's configuration");
} finally {
cfg.save();
}
}
示例14: init
import net.minecraftforge.common.Property; //导入依赖的package包/类
public static void init(CellariumConfiguration main)
{
Property reaperHiltId = main.getItem("reaperHilt.id", DefaultProps.REAPER_HILT);
reaperHilt = new ReaperHilt(reaperHiltId.getInt());
Property reaperBladeId = main.getItem("repaerBlade.id", DefaultProps.REAPER_BLADE);
reaperBlade = new ReaperBlade(reaperBladeId.getInt());
Property theReaperId = main.getItem("theReaper.id", DefaultProps.THE_REAPER);
theReaper = new TheReaper(theReaperId.getInt());
Property sorrowfelHiltId = main.getItem("sorrowfelHilt.id", DefaultProps.SORROWFEL_HILT);
sorrowfelHilt = new SorrowfelHilt(sorrowfelHiltId.getInt());
Property sorrowfelBladeId = main.getItem("sorrowfelBlade.id", DefaultProps.SORROWFEL_BLADE);
sorrowfelBlade = new SorrowfelBlade(sorrowfelBladeId.getInt());
Property sorrowfelId = main.getItem("sorrowfel.id", DefaultProps.SORROWFEL);
sorrowfel = new Sorrowfel(sorrowfelId.getInt());
Property bloodAndSorrowId = main.getItem("bloodAndSorrow.id", DefaultProps.BLOOD_AND_SORROW);
bloodAndSorrow = new BloodAndSorrow(bloodAndSorrowId.getInt());
Property ingotFrameId = main.getItem("ingotFrame.id", DefaultProps.INGOT_FRAME);
ingotFrame = new IngotFrame(ingotFrameId.getInt());
Property tearsIngotId = main.getItem("tearsIngot.id", DefaultProps.TEARS_INGOT);
tearsIngot = new TearsIngot(tearsIngotId.getInt());
}
示例15: get
import net.minecraftforge.common.Property; //导入依赖的package包/类
public Property get(String string, String category, int i) {
return config.get(category, string, i);
}