Posted June 24, 201510 yr 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.
June 24, 201510 yr 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/
June 25, 201510 yr Author 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.
June 25, 201510 yr 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!
June 26, 201510 yr Author Alright I figured it out, first get the list of ore IDs for the stack, stream them and map them to their corresponding name. Thanks for the help guys. Maker of the Craft++ mod.
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.