You could use an array or the 3x3 grid but if you know how to manipulate an array in that way then you might as well redo the inventory so it uses an array. I don't know how 3x3 works in minecraft but if using an array, each of the 9 slots relates to an xy o the array, when you drop an item in you set the item name in the array. I don't know what it's looking for in a 3x3, but if it was 2 items you would compare the items at X=0 and X=1 and see if it matches a recipe. Recipes would probably be in a second array for comparison.