Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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

  • 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.

  • 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.

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

  • 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.

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

  • 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.

  • 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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.