当前位置: 首页>>代码示例>>Java>>正文


Java ShapedRecipe.getIngredientMap方法代码示例

本文整理汇总了Java中org.bukkit.inventory.ShapedRecipe.getIngredientMap方法的典型用法代码示例。如果您正苦于以下问题:Java ShapedRecipe.getIngredientMap方法的具体用法?Java ShapedRecipe.getIngredientMap怎么用?Java ShapedRecipe.getIngredientMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.ShapedRecipe的用法示例。


在下文中一共展示了ShapedRecipe.getIngredientMap方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromBukkitRecipe

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public static CraftShapedRecipe fromBukkitRecipe(ShapedRecipe recipe) {
    if (recipe instanceof CraftShapedRecipe) {
        return (CraftShapedRecipe) recipe;
    }
    CraftShapedRecipe ret = new CraftShapedRecipe(recipe.getResult());
    String[] shape = recipe.getShape();
    ret.shape(shape);
    Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
    for (char c : ingredientMap.keySet()) {
        ItemStack stack = ingredientMap.get(c);
        if (stack != null) {
            ret.setIngredient(c, stack.getType(), stack.getDurability());
        }
    }
    return ret;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftShapedRecipe.java

示例2: fromBukkitRecipe

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public static CraftShapedRecipe fromBukkitRecipe(ShapedRecipe recipe) {
    if (recipe instanceof CraftShapedRecipe) {
        return (CraftShapedRecipe) recipe;
    }
    CraftShapedRecipe ret = new CraftShapedRecipe(recipe.getKey(), recipe.getResult());
    String[] shape = recipe.getShape();
    ret.shape(shape);
    Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
    for (char c : ingredientMap.keySet()) {
        ItemStack stack = ingredientMap.get(c);
        if (stack != null) {
            ret.setIngredient(c, stack.getType(), stack.getDurability());
        }
    }
    return ret;
}
 
开发者ID:MagicDroidX,项目名称:Brynhildr,代码行数:17,代码来源:CraftShapedRecipe.java

示例3: collect

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
Transaction collect(ShapedRecipe recipe) {
    List<ItemStack> collected = new ArrayList<ItemStack>(rows * columns);
    String[] shape = recipe.getShape();
    Map<Character, ItemStack> map = recipe.getIngredientMap();
    for (String s : shape)
        INGREDIENTS: for (int i = 0; i < s.length(); i++) {
            ItemStack ingredient = map.get(s.charAt(i));
            if (ingredient == null)
                continue;
            for (ItemStack item : collected) {
                if (ItemUtils.itemEqualsTypeAndData(item, ingredient)) {
                    item.setAmount(item.getAmount() + ingredient.getAmount());
                    continue INGREDIENTS;
                }
            }
            collected.add(ingredient);
        }
    return new Transaction(collected, recipe.getResult());
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:20,代码来源:RecipeVerifier.java

示例4: initRecipes

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public static void initRecipes()
{
	for(BagBase bb : Util.getBags())
	{
		String prefix = "recipes." + bb.getName();
		
		ShapedRecipe sr = bb.getStandardRecipe();
		Map<Character, ItemStack> map = sr.getIngredientMap();
		Material[] matArray = new Material[9];
		
		setIf(prefix + ".1", map.get(sr.getShape()[0].charAt(0)).getType().toString());
		setIf(prefix + ".2", map.get(sr.getShape()[0].charAt(1)).getType().toString());
		setIf(prefix + ".3", map.get(sr.getShape()[0].charAt(2)).getType().toString());
		setIf(prefix + ".4", map.get(sr.getShape()[1].charAt(0)).getType().toString());
		setIf(prefix + ".5", map.get(sr.getShape()[1].charAt(1)).getType().toString());
		setIf(prefix + ".6", map.get(sr.getShape()[1].charAt(2)).getType().toString());
		setIf(prefix + ".7", map.get(sr.getShape()[2].charAt(0)).getType().toString());
		setIf(prefix + ".8", map.get(sr.getShape()[2].charAt(1)).getType().toString());
		setIf(prefix + ".9", map.get(sr.getShape()[2].charAt(2)).getType().toString());

		
	}
	try {
		Bags2.recipes.save(Bags2.recipesFile);
	} catch (IOException e)
	{
		e.printStackTrace();
	}
}
 
开发者ID:benfah,项目名称:Bags2,代码行数:30,代码来源:RecipeManager.java

示例5: verify

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
boolean verify(ShapedRecipe recipe) {
    String[] shape = recipe.getShape();
    if (shape.length != rows)
        return false;
    if (shape[0].length() != columns)
        return false;

    Map<Character, ItemStack> map = recipe.getIngredientMap();

    return verifyShape(map, shape, false) || verifyShape(map, shape, true);
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:12,代码来源:RecipeVerifier.java

示例6: SerialisableShapedRecipe

import org.bukkit.inventory.ShapedRecipe; //导入方法依赖的package包/类
public SerialisableShapedRecipe(ShapedRecipe recipe) {
    this.shape = recipe.getShape();
    this.result = recipe.getResult();
    this.ingredients = recipe.getIngredientMap();
}
 
开发者ID:WaywardRealms,项目名称:Wayward,代码行数:6,代码来源:SerialisableShapedRecipe.java


注:本文中的org.bukkit.inventory.ShapedRecipe.getIngredientMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。