Leather Helm has two recipes?

Discussion in 'Plugin Development' started by Machine Maker, Jul 3, 2017.

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

    Machine Maker

    So I am making a reliable decrafting table plugin. And it works perfectly. Any craftable item you put in will be decrafted. Except for leather helmets. Now I had no idea what caused this to happen so I began debugging. For each item put in, I get all the recipes for it in a list. Then I had the console print out the size of the list. For every piece of armor in the game, the size of the recipe list is 1, except for, you guessed it. Leather Helmets. Now I know this list of recipes includes furnaces and brewing stands and everything including crafting ones.

    Code:
    List<Recipe> recipes = Bukkit.getServer().getRecipesFor(item);
                                if (!recipes.isEmpty()) { //Checks if there are recipes for the item
                                    ShapedRecipe withShape = null;
                                    ShapelessRecipe withoutShape = null;
                                    Bukkit.getConsoleSender().sendMessage("Recipes Size: " + recipes.size());
    So here I sort out the ones I don't want

    Code:
    for (Recipe r : recipes) {
                                        if (r instanceof ShapedRecipe) {
                                            withShape = (ShapedRecipe) r;
                                            break;
                                        }
                                        else if (r instanceof ShapelessRecipe) {
                                            withoutShape = (ShapelessRecipe) r;
                                            break;
                                        }
                                    }
    Now this for loop will only get the first recipe in the list. Now I wanted it that way. Cause most items do not have multiple crafting recipes. But this presents a problem for the Leather Helmet because one of the recipes, a ShapedRecipe to be more exact, is 1 Leather Helm = 1 LeatherHelm. Am I missing something obvious or is there really 2 recipes for a leather helm, 1 of them being inaccessible in the game?
     
Thread Status:
Not open for further replies.

Share This Page