Lord_Rius Posted March 24, 2013 Posted March 24, 2013 Hello guys i've a problem with 1.5 coding. Some time ago, i made a simple mod that able you to "repair " damaged items, look at this piece of code: GameRegistry.addRecipe(new ItemStack(Item.swordWood), new Object[] {" Y ", " X ", " ", 'X', new ItemStack(Item.swordWood, 1, -1), 'Y', Block.planks}); Well, with this code you can craft one brand new wooden sword with one damaged wooden sword and whatever block of planks, this works well in 1.4.7, but not in 1.5.1. Anybody can help me please. Thanks. Quote
snipes2083 Posted March 27, 2013 Posted March 27, 2013 Hello there, I would like to first say that I am by no means what you could even call a moder as I have a million questions my self. I decided to try and solve this issue, and at my level, I found that it is not quite as easy as what you had shown. This is the code that would be put in the @Init part of your main class. GameRegistry.addRecipe(new ItemStack(Item.swordWood, 1), new Object[] { "XYX", 'X', Block.planks, 'Y', new Item.swordWood }); However, the problem with this is that it does not accept a damaged item. While I have some suspicions as to ways you could go about this, I lack the experience with the base classes and forge classes to figure it out yet. On a positive note, I believe that you can use an Anvil to do the same thing that you are trying to make a recipe for. With a quick google search: [lmgtfy]minecraft anvil[/lmgtfy], I was able to come up with the following results. http://www.minecraftwiki.net/wiki/Anvil http://www.minecraftwiki.net/wiki/Anvil_mechanics On a final thought, you may be able to make a modified crafting table, with functionality of the anvil. Good luck to you. Quote
Alex_hawks Posted April 2, 2013 Posted April 2, 2013 The damage value wildcard for ItemStacks has changed, but I can't remember what it changed to... I think it changed to Integer.MIN_VALUE but I'm not certain... Quote
jordan30001 Posted April 2, 2013 Posted April 2, 2013 the random value is in oreDictionary I think it is OreDictionary.WILDCARD_VALUE Quote
Moritz Posted April 3, 2013 Posted April 3, 2013 . I made whole Mod which is makeing a lots of repair/damage recipes. I used Forloops for this. like this: for(int i = 0; i < yourItem.getMaxItemDamage(); i++) { GameRegistry.addRecipe(new ItemStack(yourItem, 1, i - extradamage), new Object [] {"XY", 'X', new ItemStack(yourItem, 1, i), 'Y', new ItemStack(repairItem, 1, 0)}); } and the forloops was about 10k. And it was about 2,5mio recipes. and the game starts to lag. Quote
Lord_Rius Posted April 13, 2013 Author Posted April 13, 2013 Thanks to all the code that for now works for me is public static final int WILDCARD_VALUE = Short.MAX_VALUE; then GameRegistry.addShapelessRecipe(new ItemStack(Item.swordIron), new ItemStack(Item.swordIron, 1, WILDCARD_VALUE), Item.ingotIron); Quote
Moritz Posted April 13, 2013 Posted April 13, 2013 I also have a hint for you. never make too much forloops! Why. I made with forloops about 2 Mio recipes. and then after coding i tried to craft a workbench and the framerate goes down to 6 everytime i put a Item/Block in the craftingmatrix! This lagging starts at 100k recipes! (Tested!) 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.