本文整理匯總了Java中net.minecraftforge.common.config.ConfigCategory.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigCategory.isEmpty方法的具體用法?Java ConfigCategory.isEmpty怎麽用?Java ConfigCategory.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.common.config.ConfigCategory
的用法示例。
在下文中一共展示了ConfigCategory.isEmpty方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupBookConfig
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void setupBookConfig(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_BOOKS);
if (category.isEmpty()) {
// Initialize with defaults
addBook(cfg, Items.BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.ENCHANTED_BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.WRITABLE_BOOK.getRegistryName().toString(), "*");
addBook(cfg, Items.WRITTEN_BOOK.getRegistryName().toString(), "*");
addBook(cfg, "rftools:rftools_manual", BookType.BOOK_BLUE.getModel());
addBook(cfg, "rftoolscontrol:rftoolscontrol_manual", BookType.BOOK_GREEN.getModel());
addBook(cfg, "rftoolsdim:rftoolsdim_manual", BookType.BOOK_GREEN.getModel());
addBook(cfg, "deepresonance:dr_manual", BookType.BOOK_RED.getModel());
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
validBooks.put(entry.getKey(), entry.getValue().getString());
}
}
}
示例2: JsonConfig
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public JsonConfig(File file){
this.keybindingFile = new File(file.getParent()+"/macrokey/keybindings.json");
this.layerFile = new File(file.getParent()+"/macrokey/layers.json");
MacroKey.instance.boundKeys = new ArrayList<BoundKey>();
MacroKey.instance.layers = new ArrayList<Layer>();
File dir = new File(file.getParent()+"/macrokey/");
if(!dir.exists()){
dir.mkdir();
}
FileHelper.fileExist(keybindingFile);
FileHelper.fileExist(layerFile);
ConfigCategory category = MacroKey.instance.configuration.getCategory("bindings");
if(!category.isEmpty()){
LogHelper.info("Old Configuration File Detected! Converting...");
convertConfig();
MacroKey.instance.configuration.removeCategory(category);
MacroKey.instance.configuration.save();
}
}
示例3: initGrindstoneRecipes
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void initGrindstoneRecipes(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_RECIPES_GRINDSTONE);
if (category.isEmpty()) {
// Initialize with defaults
addRecipe(cfg, "flour", new ItemStack(Items.WHEAT), new ItemStack(ModItems.flour), 100);
addRecipe(cfg, "bonemeal", new ItemStack(Items.BONE), new ItemStack(Items.DYE, 5, EnumDyeColor.WHITE.getDyeDamage()), 100);
addRecipe(cfg, "flint", new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT, 2), 100);
addRecipe(cfg, "glowstone", new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), 300);
addRecipe(cfg, "sugar", new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 2), 100);
addRecipe(cfg, "blazepowder", new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 3), 200);
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
String[] list = entry.getValue().getStringList();
GrindstoneRecipeRepository.addRecipe(new GrindstoneRecipe(getItem(list, 0), getItem(list, 1), getInt(list, 2)));
}
}
}
示例4: initConfig
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
@Override
public void initConfig(Configuration cfg) {
super.initConfig(cfg);
maxHardness = (float) cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_maxHardness", maxHardness, "Max hardness this block can move.)").getDouble();
placeDistance = cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_placeDistance", placeDistance, "Distance at which to place blocks in 'in-air' mode").getInt();
ConfigCategory category = cfg.getCategory(Config.CATEGORY_MOVINGBLACKLIST);
if (category.isEmpty()) {
// Initialize with defaults
blacklist(cfg, "tile.shieldBlock");
blacklist(cfg, "tile.shieldBlock2");
blacklist(cfg, "tile.shieldBlock3");
blacklist(cfg, "tile.solidShieldBlock");
blacklist(cfg, "tile.invisibleShieldBlock");
setCost(cfg, "tile.mobSpawner", 5.0);
setCost(cfg, "tile.blockAiry", 20.0);
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
blacklisted.put(entry.getKey(), entry.getValue().getDouble());
}
}
}
示例5: apply
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
@Override
public boolean apply(final Object[] input) {
final String prefix = (String) input[0];
final InputStream stream = (InputStream) input[2];
// The input stream contains the config file we need
// to merge into the master.
final JarConfiguration src = new JarConfiguration(stream);
final ConfigCategory c = src.getCategory(CONFIG_CHESTS);
// If the property in the chests.cfg has not been
// initialized copy it from the ZIP.
for (final ConfigCategory p : c.getChildren()) {
final String name = CONFIG_CHESTS + "." + prefix + "." + p.getName();
final ConfigCategory temp = target.getCategory(name);
if (temp.isEmpty()) {
for (final Entry<String, Property> item : p.getValues().entrySet()) {
temp.put(item.getKey(), item.getValue());
}
}
}
return true;
}
示例6: processTables
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
private static void processTables(final String prefix, final Matrix2D<ItemStackWeightTable> weightTables, final JarConfiguration config) {
for (final ScrapValue sv : ScrapValue.values())
for (int i = 0; i < UPGRADE_NAMES.length; i++) {
final String category = prefix + "_" + sv.name() + "_" + UPGRADE_NAMES[i];
final ConfigCategory cc = config.getCategory(category);
if(cc != null && !cc.isEmpty()) {
final ItemStackWeightTable table = new ItemStackWeightTable();
for(final Entry<String, Property> e: cc.getValues().entrySet()) {
final ItemStackItem item = getItemStackItem(table, e);
if(item != null)
table.add(item);
}
weightTables.set(sv.ordinal(), i, table);
}
}
}
示例7: initCookerRecipes
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void initCookerRecipes(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_RECIPES_COOKER);
if (category.isEmpty()) {
// Initialize with defaults
addRecipe(cfg, "cookedcarrot", new ItemStack(Items.CARROT), new ItemStack(ModItems.cookedCarrot), "", 10);
addRecipe(cfg, "cookedpotato", new ItemStack(Items.POTATO), new ItemStack(ModItems.cookedPotato), "", 10);
addRecipe(cfg, "vegetablesoup", new ItemStack(ModItems.choppedVegetables), ItemStackTools.getEmptyStack(), ItemDish.DISH_VEGETABLE_SOUP, 10);
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
String[] list = entry.getValue().getStringList();
CookerRecipeRepository.addRecipe(new CookerRecipe(getItem(list, 0), getItem(list, 1), getString(list, 2), getInt(list, 3)));
}
}
}
示例8: initCookingBoardRecipes
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void initCookingBoardRecipes(Configuration cfg) {
ConfigCategory category = cfg.getCategory(CATEGORY_RECIPES_CUTTINGBOARD);
if (category.isEmpty()) {
// Initialize with defaults
addRecipe(cfg, "chopped1", new ItemStack(Items.CARROT), new ItemStack(Items.BEETROOT), new ItemStack(Item.getItemFromBlock(Blocks.BROWN_MUSHROOM)), new ItemStack(ModItems.choppedVegetables), 2, "knife");
addRecipe(cfg, "chopped2", new ItemStack(Items.CARROT), new ItemStack(Items.BEETROOT), new ItemStack(Item.getItemFromBlock(Blocks.RED_MUSHROOM)), new ItemStack(ModItems.choppedVegetables), 2, "knife");
addRecipe(cfg, "dough", new ItemStack(ModItems.flour), ItemStackTools.getEmptyStack(), ItemStackTools.getEmptyStack(), new ItemStack(ModItems.dough), 10, "roller");
} else {
for (Map.Entry<String, Property> entry : category.entrySet()) {
String[] list = entry.getValue().getStringList();
boolean roller = "roller".equals(getString(list, 5));
CuttingBoardRecipeRepository.addRecipe(new CuttingBoardRecipe(getItem(list, 0), getItem(list, 1), getItem(list, 2), getItem(list, 3), getInt(list, 4), roller));
}
}
}
示例9: init
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void init(Configuration cfg) {
customBlockName = cfg.get(CATEGORY_GEARSWAP, "customBlockName", "", "Put a custom block name here (format <mod>:<blockname>) to use for the modded texture gear swapper").getString();
supportBaubles = cfg.get(CATEGORY_GEARSWAP, "supportBaubles", supportBaubles, "If true (and if Baubles in installed) we support the baubles slots").getBoolean();
ConfigCategory rulesCategory = cfg.getCategory(CATEGORY_RULES);
if (rulesCategory.isEmpty()) {
// Now configured rules. Add defaults.
cfg.get(CATEGORY_RULES, "item.extrautils:golden_bag", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Pickaxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Hammer", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Cleaver", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.LumberAxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Rapier", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Broadsword", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Longsword", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.FryPan", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Chisel", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Cutlass", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Scythe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Dagger", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Battlesign", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Battleaxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool", new String[] { "display" });
}
for (Map.Entry<String, Property> entry : rulesCategory.getValues().entrySet()) {
String unlocItemName = entry.getKey();
tagsThatHaveToMatch.put(unlocItemName, entry.getValue().getStringList());
}
}
示例10: init
import net.minecraftforge.common.config.ConfigCategory; //導入方法依賴的package包/類
public static void init(Configuration cfg) {
moddedTextureName = cfg.get(CATEGORY_GEARSWAP, "moddedTextureName", "", "Put a modded texture name here (format <mod>:<texture>) to use for the modded texture gear sappwer").getString();
supportBaubles = cfg.get(CATEGORY_GEARSWAP, "supportBaubles", supportBaubles, "If true (and if Baubles in installed) we support the baubles slots").getBoolean();
ConfigCategory rulesCategory = cfg.getCategory(CATEGORY_RULES);
if (rulesCategory.isEmpty()) {
// Now configured rules. Add defaults.
cfg.get(CATEGORY_RULES, "item.extrautils:golden_bag", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Pickaxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Hammer", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Cleaver", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.LumberAxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Rapier", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Broadsword", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Longsword", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.FryPan", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Chisel", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Cutlass", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Scythe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Dagger", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Battlesign", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool.Battleaxe", new String[] { "display" });
cfg.get(CATEGORY_RULES, "item.InfiTool", new String[] { "display" });
}
for (Map.Entry<String, Property> entry : rulesCategory.getValues().entrySet()) {
String unlocItemName = entry.getKey();
tagsThatHaveToMatch.put(unlocItemName, entry.getValue().getStringList());
}
}