Solved ShapedRecipe (was) not working?

Discussion in 'Plugin Development' started by Plo124, May 23, 2014.

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

    Plo124

    I know this has been asked a lot, but Im certain this code works.

    Code:java
    1. ShapedRecipe rec = new ShapedRecipe(new ItemStackBuilder(Material.WOODEN_DOOR).build());
    2. rec.shape("AAA","ASA","ASA");
    3. rec.setIngredient('A',Material.AIR);
    4. rec.setIngredient('S',Material.STICK);
    5. Bukkit.addRecipe(rec);

    ItemStackBuilder is a class I made, it does return a proper itemstack.
    Even if ItemStackBuilder didnt return a ItemStack, I am checking with the PrepareItemCraftEvent and that isnt firing. Neither is the item showing in the Crafting Table.

    Yes yes, the code I posted is in my onEnable.
    Also the PrepareItemCraftEvent is being called, because I put some wooden planks, and made a boat, and it broadcasted the event.
     
  2. Offline

    teej107

    Try and make the recipe with just an ItemStack in the parameters rather than using an ItemStackBuilder. That's what works for me. I also didn't need to use a PrepareItemCraftEvent.
     
  3. Offline

    Plo124

    teej107
    PrepareItemCraftEvent allows you to get the itemStacks in the crafting grid, which is what I need to do to get their display name.
     
  4. Offline

    teej107

    Plo124 Well try it without using your ItemStackBuilder and use an ItemStack. I didn't have any troubles with a shaped recipe. Remove the Air material from your recipe
     
    Plo124 likes this.
  5. Offline

    Plo124

    teej107
    So I dont define the air, and just leave it as A?
    Thanks, your the best
     
  6. Offline

    teej107

    Just remove that part of the code.
    Code:
    rec.setIngredient('A',Material.AIR);
     
Thread Status:
Not open for further replies.

Share This Page