its a bit more complicated, items could be 2x3 in dimensions, when the player tries to place an item in a slot (index X) you have to iterate over all the slots it will take,
you’ll need a function to convert index to grid and visa versa, ie grid (x,y) = index Z