Jump to content

Recommended Posts

Posted

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?

 

Posted

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.

Posted

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?

Posted

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.

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.