我如何在食谱中使用itemStack

问题描述

嗨,我正在使用1.16 spigot api制作插件,但我一直试图在食谱中获取itemStack。我使用的是1.8 spigot API,但是当我感到自己需要第三方API或制作自己的制作系统时,我选择从1.8更改为1.16

食谱

NamespacedKey key = new NamespacedKey(this,"emerald_sword");
ShapedRecipe recipe = new ShapedRecipe(key,sword);
recipe.shape(" E "," E "," S ");
recipe.setIngredient('E',RecipeChoice.ExactChoice(enchantedEmerald));// part not working
recipe.setIngredient('S',Material.STICK);
Bukkit.addRecipe(recipe);

翡翠剑

ItemStack sword = new ItemStack( Material.DIAMOND_SWORD );
ItemMeta IM = sword.getItemMeta();
IM.setDisplayName(ChatColor.GREEN + "Emerald Sword" );
sword.setItemMeta( IM );
sword.addEnchantment( Enchantment.DAMAGE_ALL,5 );

魔法绿宝石

ItemStack enchantedEmerald = new ItemStack( Material.EMERALD );
ItemMeta EEM = enchantedEmerald.getItemMeta();
EEM.setDisplayName("enchanted Emerald");
ArrayList<String> lore = new ArrayList<String>();
lore.add("enchanted Emeralds is an rare material");
EEM.setLore(lore);
enchantedEmerald.setItemMeta(EEM);

订单是祖母绿剑,附魔祖母绿和配方

我如何在食谱中使用itemStack

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)