Jump to content

[1.7.10] Getting IRecipe regents.


SuperKael

Recommended Posts

What I am attempting to do, is calculate a global "value" for every item in the game, including mods items. now I am aware that this will not be possible, but my goal is to specify the value of various "raw materials" and have my mod dynamically calculate the value of items that are crafted from said raw materials. My problem is, I can't for the life of me determine how to get the regents used in a crafting recipe. I have tried looking at the source code for NEI, but that wasn't very helpful too me. Since I don't even have a clue where to start, I don't have any code to show. In case anybody is wondering, I am making a mod that allows you to create tools from anything, and although I FINALLY got the dynamic tool rendering worked out, this is my next big obstacle. but if I can get this worked out, then there really won't be anything preventing me from completing my mod! :D

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

Link to comment
Share on other sites

IRecipe tmpRecipe = /*whatever*/;
	 if (tmpRecipe instanceof ShapedRecipes) {
	 ShapedRecipes recipe = (ShapedRecipes)tmpRecipe;
	 ItemStack[] ingredients = recipe.recipeItems
 }
 else if (tmpRecipe instanceof ShapelessRecipes) {
	 ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe;
	 List ingredients = recipe.recipeItems;
 }

 

There's a few other recipe types, as well.  And mods can add their own.

 

You'll also have to look at SmeltingRecipes for the furnace, and some mods add their own machines that do conversions as well (like IC2's macerator) which might not be accessible except through that mod's API (if at all).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ok, thanks so much. sad to hear that there is no universal method for IRecipe. then again, if there was, I bet NEI would be quite a bit more versitile xD. anyways, thanks for your help. as for custom recipes with IC2 and such, I can use Swing and good old JD-GUI to figure that out.

If I ever say something stupid, or simply incorrect, please excuse me. I don't know anything about 1.8 modding, and I don't know much about entities either, But I try to help when I can.

Link to comment
Share on other sites

Check out CraftingManager's getRecipeList method. It returns a list containing all registered recipes.

 

That returns the list of

IRecipe

objects (which he already figured out), not their ingredients.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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