Posted May 5, 201411 yr Hi all, I have a very simple issue, but I haven't been able to find a simple answer to it. All I want to do, is get the recipe of an item or block. More specifically, I want to get the recipe of every item or block in the game (Including items added by mods). I think NEI does this, and I do believe they have an API but I have yet to find proper documentation on it. I've tried @EventHandler public void postInit(FMLPostInitializationEvent event) { List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList(); } However this does not include many recipes for vanilla items such as tools. Am I running it too early?
May 6, 201411 yr Of course most recipes would be saved to the IRecipes, but there are an exceptional case. Tool Damage adding Recipes is the case. They are processed externally, not related with the IRecipes. You can see the code in the net.minecraft.item.crafting.CraftingManager. However, It is simple case so you would easily be able to deal with the case. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
May 6, 201411 yr Author So every recipe except the ones you mentioned are stored in CraftingManager.getInstance().getRecipeList();? Right now I'm checking each IRecipe in that list if it is an instance of ShapedRecipes or ShapelessRecipes. Should I be checking for others? For example swords and other tools don't seem to be shaped or shapeless so what are they?
May 6, 201411 yr They are another type of recipe, so you have to check each of them. It might be hard to deal with all of them, but it is necessary if you want to deal with every recipe. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
May 6, 201411 yr IRecipe already has many methods you can use. It is probably unnecessary to check and cast for each type.
May 7, 201411 yr So, you have to deal with each of them. It seems that there are no other ways to do that. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.