ShapedRecipe#setIngredient

Discussion in 'Plugin Development' started by tlm920, Aug 20, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    tlm920

    I have a small quick question, how would I would set the amount of an ingredient in a shaped recipe? I thought about creating an ItemStack with the amount I want but ShapedRecipe#setIngredient uses Material and not ItemStack as a parameter.

    Example: use 2 sticks as an ingredient instead of 1.

    Any help is appreciated :D
     
  2. Offline

    Kars

    That is not possible using ShapedRecipe.
    It is possible to do this with PrepareCraftEvent, but creating custom recipes this way makes you run into other problems.
     
  3. Offline

    tlm920

    @Kars
    Are you sure I can't use ItemStack#getData with an ItemStack set with 2 sticks and put that as the material?

    EDIT: I have an idea, maybe I can use my own custom crafting table?
     
  4. Offline

    Kars

    @tlm920 don't bank on it.
    I have done some experiments with PrepareItemCraftEvent in the past, and using GetMatrix on the craftinginventory it is possible to do custom recipes. You can check for enchants on items, for example. You would also be able to do what you require.
    The problem is, though, that the result becomes infinite when putting in multiple items into the crafting grid. I haven't found a solution to this problem, but i must say i have not given it alot of time.
     
Thread Status:
Not open for further replies.

Share This Page