Atijaf Posted May 30, 2016 Posted May 30, 2016 I am adding my own crafting requirements to some tools, including this one. I've made a way to automate a process so that I would not have to re-enter all of the crafting recipes for each and every item. This automation grabs the recipe from the IRecipe like so. //My recipe String. It is later separated every 3 places into 3 separate Strings. //Used to define where and what an item is in the recipe char letters[] = {'a','b','c','d','e','f','g','h','i'}; String recipeData = ""; //Gets list of Items within Object[] locationNumbers = ((ShapedOreRecipe)recipe).getInput(); for(int i = 0; i < locationNumbers.length; i++) { //Null Checks and instanceChecks //Add to the crafting recipe (It would look similar to this , //"abc", "def", "ghi" ... But not in this case. Read notes below...) recipeData += letters[i]; } in the end, the recipeData looks like... "abc" , "d f", "". When it should look like... "ab " , "cd " , " f " And after Everything is finished, it would look like this... "aa " , "ad" , " d " , 'a', new ItemStack(Blocks.Blocks.planks), 'd', new ItemStack(Items.stick); ... Which happens to be the recipe for the axe, more or less. More information: locationNumbers is an array of data (0 through 8, with some being null for blank spots) for the axe, locationNumbers holds datas (0,1,2,3,5) numbers 4,6,7,8 are null. or in other words, my recipe would look like this if I stored numbers from directly above. "012", "3 5", "" AND that's not the axe shape. Another thing to note is that this works on about a hundred other recipes. And for the question if you haven't guessed it. Anyone have any clue as to why locationNumbers have datas (0,1,2,3,5) and not (0,1,3,4,7)? or ("01 " , "34 " , " 7 ") Fore reference I tried to simplify what was being asked, so information in paste bin is slightly different. http://pastebin.com/isxPNT8z Quote
Atijaf Posted May 30, 2016 Author Posted May 30, 2016 I am adding my own crafting requirements to some tools, including this one. I've made a way to automate a process so that I would not have to re-enter all of the crafting recipes for each and every item. This automation grabs the recipe from the IRecipe like so. //My recipe String. It is later separated every 3 places into 3 separate Strings. //Used to define where and what an item is in the recipe char letters[] = {'a','b','c','d','e','f','g','h','i'}; String recipeData = ""; //Gets list of Items within Object[] locationNumbers = ((ShapedOreRecipe)recipe).getInput(); for(int i = 0; i < locationNumbers.length; i++) { //Null Checks and instanceChecks //Add to the crafting recipe (It would look similar to this , //"abc", "def", "ghi" ... But not in this case. Read notes below...) recipeData += letters[i]; } in the end, the recipeData looks like... "abc" , "d f", "". When it should look like... "ab " , "cd " , " f " And after Everything is finished, it would look like this... "aa " , "ad" , " d " , 'a', new ItemStack(Blocks.Blocks.planks), 'd', new ItemStack(Items.stick); ... Which happens to be the recipe for the axe, more or less. More information: locationNumbers is an array of data (0 through 8, with some being null for blank spots) for the axe, locationNumbers holds datas (0,1,2,3,5) numbers 4,6,7,8 are null. or in other words, my recipe would look like this if I stored numbers from directly above. "012", "3 5", "" AND that's not the axe shape. Another thing to note is that this works on about a hundred other recipes. And for the question if you haven't guessed it. Anyone have any clue as to why locationNumbers have datas (0,1,2,3,5) and not (0,1,3,4,7)? or ("01 " , "34 " , " 7 ") Fore reference I tried to simplify what was being asked, so information in paste bin is slightly different. http://pastebin.com/isxPNT8z Quote
Recommended Posts
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.