It is in fact implemented correctly.
Your explanation is unclear. What do you mean it won’t do anything useful? What else have you tried?
And SlotPos retrieves the x and y coordinates of the slot on the 2D plane of slots. If you want to get the one-dimensional index, you’d use SlotIndex for that.
As mentioned above SlotPos is only for grid inventories and does not always exists. slot.getInventoryProperty(SlotIndex.class) is the way to get a SlotIndex.