Posted April 11, 20169 yr java.lang.ArrayIndexOutOfBoundsException: 5 at net.minecraft.item.ItemAxe.<init>(ItemAxe.java:19) ~[forgeSrc-1.9-12.16.0.1858-1.9.jar:?] at ... Error is caused by a subclass of ItemAxe calling super(custom material) Sword, Shovel and Pickaxe work fine.
April 11, 20169 yr Modder error, not Forge. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
April 11, 20169 yr Author But swords, pickaxes and shovels all work fine with the custom tool material, and the axe works fine if I substitute ToolMaterial.IRON there.
April 11, 20169 yr Author It is all caused by ATTACK_DAMAGES[material.ordinal()], due to any custom tool material going of range of the 5-length array of vanilla materials.
April 11, 20169 yr You say this like I don't know it. There should be no reason mods need to explicitly subclass ItemAxe, any item can be an axe, that class means nothing. Just subclass tool and do it yourself. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
April 12, 20169 yr Author There should be no reason mods need to explicitly subclass ItemAxe, any item can be an axe, that class means nothing. Just subclass tool and do it yourself. So, its better to add all the axes to the ore dictionary than to add an if statement/alternative constructor? What is the point of object-orientation if you are not going to use it? I fail to see how expecting to be able to have an axe extend ItemAxe, only to have it error is the fault of the modder, and not forge itself.
April 12, 20169 yr Again this is something that nobody has actually bothered to actually look into. But what is the POINT of extending the ItemAxe? Forge already has hooks in place to define what type of tool the item is, no matter what class it is. So why do you need to extend this specific class. I have yet to hear a SINGLE argument besides 'My 1.8 code errors in 1.9!!!!!!' I'm not against adding a bypass constructor. But I need someone to articulate WHY beyond just bitching. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
April 12, 20169 yr Author Forge already has hooks in place to define what type of tool the item is, no matter what class it is. Oh, I see. I was just assuming that "an Axe is determined as anything that extends ItemAxe". I take it I would have to simply override getToolClasses? I take it that this issue is why the constructor for ItemAxe is protected? However, I think that the ability to create an axe without needing to add any more classes would be reason enough to add a second, public constructor. At least make ItemAxe final, to prevent this sort of issue from happening.
April 12, 20169 yr This has also been discussed on GitHub. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
April 12, 20169 yr Author You can make an axe without making "any new classes". Item myAxe = new Item(); myAxe.setHarvestLevel("axe", 3); // for diamond, see the javadocs for other values I... did not know about that. Is that new in 1.9? Still, I think that ItemAxe should be changed as not to error, or simply be final, so that people don't continuously make the same mistake that I did.
April 12, 20169 yr I... did not know about that. Is that new in 1.9? No. It looks like the current version of the harvest tool system was added in 1.7.2; but there was a slightly different version of the same system in place before that. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.