Custom crafting recipe.

Discussion in 'Spigot Plugin Development' started by MTM123, May 8, 2015.

  1. Hello!
    After bothering people in Spigot IRC and not finding out anything usefull out I decided to post my issue or rather my insufficient knowledge.
    Bassicly I want to create plugin which takes 1 splash potion and 4 arrows.
    I know the part about creating shapeless and shaped recipes and also making them using custom ingredients but I can't figure out how to use correct amount of materials in same stacks.

    Here are pictures for better understanding:
    I want to achieve this:

    addIngredient(4, Material.ARROW) only works like this:

    I hope someone can help me and maybe will also help others who are struggling with this issue too.

    Thanks already for your time!
  2. Don't know if it's possible to add amounts on ingredients? Or you need to make a Itemstack and set a amount > then set the itemstack in your setIngredient()
  3. However, addIngredient() doesn't support data type ItemStack.
  4. Yeah, was already afraid of that. I don't think it's possible then.
  5. Don't think it works but I do have two options which you could use.

    1. Just make the recipe have arrows all around the potion.

    2. Make four different crafting recipes, each one will require an arrow until you reach the final product.
  6. Maybe test for the inventory click event,
    1. if the clicked slot is the output slot,
    2. test for the items in the crafting slots and their amounts,
      (Maybe add total amounts to a variable and test at end of loop, take amounts from itemstacks and add to int itemCount)
    3. if the above 2 match what is expected
    4. cancel the event,
    5. manually clear slots,
    6. and manually give the item you want to give
    In theory this might work, but you'll have to test it
  7. I actually have one thing in mind that could work. I will try it and then report back here