Mantle

Mantle

157M Downloads

java.lang.ArrayIndexOutOfBoundsException in CraftingItem.class

ShenTengTu opened this issue ยท 3 comments

commented

Hi,I am testing the compatibility of my mod Large Sign with Tinkers Construct + Mantle,then I get the crash report as below when my mod want to get the icon:
http://pastebin.com/7yk0mt1h

There is ArrayIndexOutOfBoundsException in CraftingItem,I hope you can take a look,thanks.

commented

Which object causes it?

commented

I originally using Mantle 0.3.1 and 0.3.2 jar file to test in actual game environment,then I get the crash report.Now I import Mantle source code to my project to debug.

In my project ,I want to get icons of all items in game.There are 4 Mantle item with meta but the length of icons array in CraftingItem class is 1,that's why I get ArrayIndexOutOfBoundsException when call func_77617_a (int meta) /getIconFromDamage(int meta).

Finally I found the problem in Mantle class as below:

    public void postInit (FMLPostInitializationEvent evt)
    {
        logger.info("Entering postinitialization phase.");
        proxy.readManuals();
        BookData data = new BookData();
        data.unlocalizedName = "item.mantle.manual.test";
        data.toolTip = "Test Book";
        data.modID = CoreRepo.modId;
        BookDataStore.addBook(data);
        mantleBook.updateManual();//Cause of the problem
        CoreConfig.loadBookLocations();
        IDDumps.dump();
    }

Cause of the problem is mantleBook.updateManual(),it will Change length of icons from 4 to 1.
I hide it then run successfully with my mod.

commented

originally my function be invoked in init(FMLInitializationEvent e) which want to get a list for all of items,so it can't update when updateManual() be invoked in postInit (FMLPostInitializationEvent e).
Now I change invoke timing of the function,then the game run successfully.