Jump to content

Recommended Posts

Posted

Hello all.

 

I am having an error when inserting an ore into a slot on my macerator. The crash log can be seen in that pastebin link below.

 

http://pastebin.com/4skAD0B9

 

It works fine when it is in eclipse but when I have recompiled and reobfuscated it, and add it to a mod pack in this instance FTB Monster, it crashes.

I would really like to get this fixed so I can add it to my server. I looked through the error log and went over the code but I cannot see anything that would do it as it runs fine in eclipse!

Macerator TileEntity Class

 

  Reveal hidden contents

 

 

 

The code was from ScratchForFun's tutorial and I have made a few edits.

 

Thanks!

 

- ZippyBling

Nick

Posted

Hey, um, I wouldn't make the arrays 0. Just saying. In the crash report, it says that there is an IndexOutOfBoundsException with zero involved. In all the instances, i is equal to 0 or slots[0] is involved.

 

That's most likely your error.

-Mitchellbrine

 

  Quote

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

  Quote
I don't want your charity, I want your information
Posted
  On 3/17/2014 at 4:44 AM, Mitchellbrine said:

Hey, um, I wouldn't make the arrays 0. Just saying. In the crash report, it says that there is an IndexOutOfBoundsException with zero involved. In all the instances, i is equal to 0 or slots[0] is involved.

 

That's most likely your error.

 

If you would read the error, you would see it appears to be in this method:

public boolean isOre(ItemStack itemstack)

Also he doesn't make any array with the size of 0.

 

To ZippyBling:

What I can see is that this is your problem:

             if(OreDictionary.getOres(oreNames) != null){
                if(OreDictionary.getOres(oreNames).get(0).itemID == itemstack.itemID){
                   return true;                 
                }
             }

You check if the value returned by getOres is not null but don't check if it has a size > 0.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

In simple terms, there may be a list (it's not null) but it also may be empty (it has no 0th element). Unless you know for a fact that the list is non-empy, check for it before using any element.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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