Adding ShapelessRecipe - not adding?

Discussion in 'Spigot Plugin Development' started by iProgramIt, May 3, 2017.

Thread Status:
Not open for further replies.
  1. Hi,

    So I'm making a plugin where crafting a bit of dye and a water bucket will result in a lighter colour. Now, I have this method;
    Code (Text):
        void AddStandard() {
            ItemStack dye = new ItemStack(Material.INK_SACK, 3, (short) 15);
            ItemStack bucket = new ItemStack(Material.BUCKET, 1);
            ShapelessRecipe Dye = new ShapelessRecipe(dye);
            ShapelessRecipe Bucket = new ShapelessRecipe(bucket);

            Dye.addIngredient(Material.INK_SACK, 7);
            Bucket.addIngredient(Material.INK_SACK, 7);

    which I call at OnEnable().

    However, when I try to craft a light gray dye with a water bucket, I don't get any item. This doesn't work with other dyes, either. However, oddly, I used ShapedRecipe (which was a pain) and it worked flawlessly. Can someone please give me some assistance / guidance as to what's wrong and how to fix it? Thanks.
  2. md_5

    Administrator Developer

    You're adding two recipes with exactly the same ingredients and those recipes are:
    Gray Dye + Water -> Black Dye
    Gray Dye + Water -> Bucket

    Methinks you've gotten a bit mixed up, double check your code.
  3. Yes, it should've worked though. As it worked to what I wanted it to do when it was ShapedRecipe (empty the water bucket in the recipe).
  4. Uh, @md_5 even with that removed it's not working. Ideas?
  5. Did you name the method onEnable() or OnEnable()? Java is very case-sensitive.
    • Agree Agree x 1
  6. md_5

    Administrator Developer

    You said you're making a recipe for gray dye, but the code you've posted is a recipe for a bucket (or black dye).
  7. Uhh.. I don't think you should set the emptied bucket as a crafting result. Rather just replace the filled bucket with an empty one; not really sure how Bukkit / Minecraft implemented it at first. Could be it even auto-empties itself (most likely, did you try?), who knows?
  8. It's fine now, I found a workaround. @megamichiel I called onEnable() - my bad.

    Thanks for the help.
Thread Status:
Not open for further replies.