Changing amount of items for recipe

Discussion in 'Spigot Plugin Development' started by CCrazyDEV, Sep 10, 2019.

  1. How can I change the needed amount of an item for a custom recipe?
     
  2. 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
     
  3. if you are using 1.13.2+ you can use a RecipeChoice ... this allows for modifying an ItemStack vs. just picking a single material
     
    • Agree Agree x 1
    • Useful Useful x 1
  4. How exactly does RecipeChoice work?
     
  5. You create a recipe as normal, and then for one of the ingredients, you create a new ExactChoice

    ex:
    Code (Java):
    ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.DIAMOND_SWORD));
    recipe.shape("111", "121", "111");
    recipe.setIngredient('1', Material.DIRT);
    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.
     
    • Useful Useful x 1
  6. Thank you very much!
     
    • Friendly Friendly x 1