JCSlotStruct

JC Slot Struct


Above is an example of all the data held in a JcSlotStruct.

A JCSlotStruct represents each square in the Player Inventory GUI.

The JcSlot Struct is made up of 3 variables, The quantity of items in the slot, the item data that is in the slot, and the parent index.

The parent index is only set if the item slot is invalid because another item is overlapping the slot. The sysem uses basic math to convert a 1d array into a 2d array, however we know that items can be bigger then one slot. When an item is bigger then a slot, it will set all of its overlapping slots parent index to its own index.

For example, a box the size of 2 x 2 is placed in ItemSlots[0], then we would use

ItemSlots[Grid to index(0,0)].parentindex = 0; //We set it to 0 because the item data is at index 0.

ItemSlots[Grid to index(0,1)].parentindex = 0;

ItemSlots[Grid to index(1,0)].parentindex = 0;

ItemSlots[Grid to index(1,1)].parentindex = 0;

To explain this, read up on Grid To Index, and Index To Grid.