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


Java ShapedRecipe.getResult方法代碼示例

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


在下文中一共展示了ShapedRecipe.getResult方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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.getResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。