Jump to content

How to process OreDictionary recipes


Anon10W1z

Recommended Posts

I want to determine the inputs, as strings, from an OreDictionary recipe. For example, for an iron pickaxe get the inputs as:

["ingotIron", "ingotIron", "ingotIron", "null", "stickWood", "null", "null", "stickWood", "null"]

Maker of the Craft++ mod.

Link to comment
Share on other sites

Those are the String used as keys in the OreDictionary. You can get an

ArrayList<ItemStack>

using

OreDictionary.getOres()

and as a parameter the Strings you get, to get the ItemStacks that can be used for the recipe.

 

BTW, what are you trying to do? Are you sure there isn't another way of doing what you are trying to do?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Those are the String used as keys in the OreDictionary. You can get an

ArrayList<ItemStack>

using

OreDictionary.getOres()

and as a parameter the Strings you get, to get the ItemStacks that can be used for the recipe.

 

BTW, what are you trying to do? Are you sure there isn't another way of doing what you are trying to do?

I want to do it the other way around. From an ore dictionary recipe, get the inputs as strings.

 

 

And my mod is unique,

Maker of the Craft++ mod.

Link to comment
Share on other sites

You have 2 kinds of OreRecipe: ShapedOreRecipe and ShapelessOreRecipe.

 

The ShapedOreRecipe object has a method called getInput() which gives you an array of Objects, which are either an ItemStack, an ArrayList<ItemStack>, or null.

 

The ShapelessOreRecipe has the same method, but returns an ArrayList<Object>. The objects in the arraylist are, once again, an ItemStack or an ArrayList<ItemStack>.

 

There is a trick to get the orename from that arraylist of itemstacks (since that's the collection that contains all possible itemstacks). If you can't figure it out I'll tell you, but I don't feel like spoonfeeding you everything. Let's see if you can figure this one out. :3

 

Good luck!

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.

Announcements



×
×
  • Create New...

Important Information

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