I hope I'm correct with this explanation.
Take a look at my code inside the unpack method for (game)interfaces
Code:
if(gInterface.interfaceType == 2){
gInterface.containerItemIds = new int[gInterface.width * gInterface.height];
gInterface.containerStackSizes = new int[gInterface.width * gInterface.height];
gInterface.allowClick = stream.getUByte() == 1;
gInterface.isInventoryInterface = stream.getUByte() == 1;
gInterface.usableItemInterface = stream.getUByte() == 1;
gInterface.allowDrag = stream.getUByte() == 1;
gInterface.invSpritePadX = stream.getUByte();
gInterface.invSpritePadY = stream.getUByte();
gInterface.spritesX = new int[20];
gInterface.spritesY = new int[20];
gInterface.sprites = new Sprite[20];
for(int j2 = 0; j2 < 20; j2++){
int k3 = stream.getUByte();
if(k3 == 1){
gInterface.spritesX[j2] = stream.getSShort();
gInterface.spritesY[j2] = stream.getSShort();
String fileName = stream.getString();
if(streamLoader_1 != null && fileName.length() > 0){
int separator = fileName.lastIndexOf(",");
gInterface.sprites[j2] = getSprite(Integer.parseInt(fileName.substring(separator + 1)), streamLoader_1, fileName.substring(0, separator));
}
}
}
gInterface.actions = new String[5];
for(int l3 = 0; l3 < gInterface.actions.length; l3++){
gInterface.actions[l3] = stream.getString();
if(gInterface.actions[l3].length() == 0)
gInterface.actions[l3] = null;
if(gInterface.parentId == 1644)
gInterface.actions[2] = "Operate";
}
}
It's refactored so you'll have to figure out how various variables are called in your source code.
Make sure both containerItemIds and containerStackSizes have the correct size as those are the most likely candidates of your ArrayIndexOutOfBoundsException.
EDIT:
I forgot to answer your original question.
The maximum of 20 items shown.
This is indeed something you'd need to increase.
In my above code look for spritesX, spritesY and sprites. The 20 you see there is the maximum you encounter.
BUT that's not all.
There's also some code preventing processing more than 20 slots in those arrays.
If you look for usages of those arrays you'll find they're ignored when using an index of 20 or higher.
You'll need to compare this to the size of the array instead.
Right now I myself can find it in 3 places + once in the unpack method.
It looks something like this:
Code:
if(parsedSlot < 20){
spriteSlotX += gameInterface.spritesX[parsedSlot];
spriteSlotY += gameInterface.spritesY[parsedSlot];
}
Code:
if(slot < 20){
j3 += childInterface.spritesX[slot];
k3 += childInterface.spritesY[slot];
}
Code:
} else if(gameInterface.sprites != null && parsedSlot < 20){
Sprite class30_sub2_sub1_sub1_1 = gameInterface.sprites[parsedSlot];
if(class30_sub2_sub1_sub1_1 != null)
class30_sub2_sub1_sub1_1.drawSprite(spriteSlotX, spriteSlotY);
}
DO NOT change this to the new size of container. But change this to the maximum number of items you want to display.
EDIT 2:
Now that I think about it, I have no idea why an inventory can display more than 20 items.