我不能附魔自定义制作配方的结果



嗨,我试图使这个插件,当有人制作这个自定义配方,它将是一张纸,有魅力的运气这里有一个例子(没有魅力):

ItemStack item = new ItemStack(Material.PAPER, 1);

ShapedRecipe recipe = new ShapedRecipe(item);

recipe.shape("^&^", "%#%", "^%^");

recipe.setIngredient('^', Material.NETHERITE_SCRAP);
recipe.setIngredient('&', Material.DIAMOND);
recipe.setIngredient('%', Material.GOLDEN_APPLE);
recipe.setIngredient('#', Material.NETHERITE_INGOT);



this.getServer().addRecipe(recipe);

这个工作很好,但每次我试图迷住它,整个制作配方不工作。例子:

ItemStack item = new ItemStack(Material.PAPER, 1);

ShapedRecipe recipe = new ShapedRecipe(item);

recipe.shape("^&^", "%#%", "^%^");

recipe.setIngredient('^', Material.NETHERITE_SCRAP);
recipe.setIngredient('&', Material.DIAMOND);
recipe.setIngredient('%', Material.GOLDEN_APPLE);
recipe.setIngredient('#', Material.NETHERITE_INGOT);

recipe.getResult().addEnchantment(Enchantment.LUCK, 1);

this.getServer().addRecipe(recipe);

开始配方前附魔:

ItemStack item = new ItemStack(Material.PAPER, 1);
ItemMeta meta = item.getItemMeta();
meta.addEnchant(Enchantement.LUCK, 1); // add enchant
item.setItemMeta(meta);
ShapedRecipe recipe = new ShapedRecipe(item); // now starting recipe creation
recipe.shape("^&^", "%#%", "^%^");

recipe.setIngredient('^', Material.NETHERITE_SCRAP);
recipe.setIngredient('&', Material.DIAMOND);
recipe.setIngredient('%', Material.GOLDEN_APPLE);
recipe.setIngredient('#', Material.NETHERITE_INGOT);
this.getServer().addRecipe(recipe);

最新更新