Anyway - I always understood it was magic spectacles and not a hat, but the hat seem to be the focus and underpants!.
I believe it was what they call a "Seer stone."
https://www.churchofjesuschrist.org/study/history/topics/seer-stones?lang=eng
The person puts the stone in a hat or a large bowl and then puts their face in it, (Think Harry Potter and the Pensieve...)
The stone then allegedly reveals to the practitioner the location of lost objects, buried treasure, yada, yada, yada.