Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by CCrazyDEV, Sep 10, 2019.
How can I change the needed amount of an item for a custom recipe?
Currently recipes only handle 1 item amount per slot, so if you want to increase the amount of an item you need to redesign your recipe
if you are using 1.13.2+ you can use a RecipeChoice ... this allows for modifying an ItemStack vs. just picking a single material
How exactly does RecipeChoice work?
You create a recipe as normal, and then for one of the ingredients, you create a new ExactChoice
ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.DIAMOND_SWORD));
recipe.shape("111", "121", "111");
recipe.setIngredient('2', new RecipeChoice.ExactChoice(new ItemStack(Material.GOLD_BLOCK, 10)));
In the last line you can see I'm adding an exact choice of a gold block, 10 of them.
Please do keep in mind ExactChoice is marked as DraftAPI as it may change if/when bugs are found.
Thank you very much!