當前位置: 首頁>>代碼示例>>Java>>正文


Java ShapelessRecipe.getIngredientList方法代碼示例

本文整理匯總了Java中org.bukkit.inventory.ShapelessRecipe.getIngredientList方法的典型用法代碼示例。如果您正苦於以下問題:Java ShapelessRecipe.getIngredientList方法的具體用法?Java ShapelessRecipe.getIngredientList怎麽用?Java ShapelessRecipe.getIngredientList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.inventory.ShapelessRecipe的用法示例。


在下文中一共展示了ShapelessRecipe.getIngredientList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromBukkitRecipe

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
public static CraftShapelessRecipe fromBukkitRecipe(ShapelessRecipe recipe) {
    if (recipe instanceof CraftShapelessRecipe) {
        return (CraftShapelessRecipe) recipe;
    }
    CraftShapelessRecipe ret = new CraftShapelessRecipe(recipe.getResult());
    for (ItemStack ingred : recipe.getIngredientList()) {
        ret.addIngredient(ingred.getType(), ingred.getDurability());
    }
    return ret;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:11,代碼來源:CraftShapelessRecipe.java

示例2: fromBukkitRecipe

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
public static CraftShapelessRecipe fromBukkitRecipe(ShapelessRecipe recipe) {
    if (recipe instanceof CraftShapelessRecipe) {
        return (CraftShapelessRecipe) recipe;
    }
    CraftShapelessRecipe ret = new CraftShapelessRecipe(recipe.getKey(), recipe.getResult());
    for (ItemStack ingred : recipe.getIngredientList()) {
        ret.addIngredient(ingred.getType(), ingred.getDurability());
    }
    return ret;
}
 
開發者ID:MagicDroidX,項目名稱:Brynhildr,代碼行數:11,代碼來源:CraftShapelessRecipe.java

示例3: collect

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
Transaction collect(ShapelessRecipe recipe) {
    List<ItemStack> ingredients = recipe.getIngredientList();
    List<ItemStack> collected = new ArrayList<ItemStack>(ingredients.size());
    INGREDIENTS: for (ItemStack ingredient : ingredients) {
        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,代碼行數:15,代碼來源:RecipeVerifier.java

示例4: verify

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
/**
 * Returns true if the recipe contained in this verifier matches the given
 * {@link ShapelessRecipe}.
 * 
 * @param recipe
 * @return True if the recipe was verified.
 */
boolean verify(ShapelessRecipe recipe) {
    List<ItemStack> ingredients = recipe.getIngredientList();
    for (int i = 0; i < rows; i++) {
        RECIPEITEM: for (int j = 0; j < columns; j++) {
            ItemStack recipeItem = matrix[i][j];
            if (recipeItem == null)
                continue;
            for (Iterator<ItemStack> it = ingredients.iterator(); it.hasNext();) {
                ItemStack ingredient = it.next();

                if (ItemUtils.recipeIngredientEqualsTypeAndData(ingredient, recipeItem)) {
                    int amount = ingredient.getAmount();
                    if (amount == 1)
                        it.remove();
                    else
                        ingredient.setAmount(amount - 1);
                    continue RECIPEITEM;
                }
            }
            // An item in the matrix is not on the ingredient list.
            return false;
        }
    }

    // If the list of ingredients was exhausted, recipe verified.
    if (ingredients.size() == 0)
        return true;

    // Unsatisfied ingredients remain.
    return false;
}
 
開發者ID:StarQuestMinecraft,項目名稱:StarQuestCode,代碼行數:39,代碼來源:RecipeVerifier.java

示例5: SerialisableShapelessRecipe

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
public SerialisableShapelessRecipe(ShapelessRecipe recipe) {
    this.ingredients = recipe.getIngredientList();
    this.result = recipe.getResult();
}
 
開發者ID:WaywardRealms,項目名稱:Wayward,代碼行數:5,代碼來源:SerialisableShapelessRecipe.java

示例6: shapelessRecipesMatch

import org.bukkit.inventory.ShapelessRecipe; //導入方法依賴的package包/類
/**
 * Checks to see if the ingredients of the recipes are the same.
 *
 * @param a Recipe A
 * @param b Recipe B
 * @return If A & B have the same ingredients
 */
private boolean shapelessRecipesMatch(ShapelessRecipe a, ShapelessRecipe b) {
    final List<ItemStack> aL = a.getIngredientList();
    final List<ItemStack> bL = b.getIngredientList();
    return aL.size() == bL.size() && aL.containsAll(bL);
}
 
開發者ID:RoyalDev,項目名稱:RoyalSurvivors,代碼行數:13,代碼來源:SurvivorsListener.java


注:本文中的org.bukkit.inventory.ShapelessRecipe.getIngredientList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。