當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。