A sluice works like an automated gold pan. It requires running water to work, and once you insert some dirt material, the sluice will generate gems and ores, depending on what minerals exist below where the dirt was collected.
Crafting the sluice requires 3 lumber and 3 sticks, arranged like a stairway with planks in the bottom corner and the sticks in the diagonal.
To use the sluice, you must have running water. The sluice must be placed one level below the end of a stream of running water, otherwise water will flow over the sluice. The end of the sluice must also be one level below the sluice, for water to run down.
To use the sluice, either throw in a dirt block or fill the sluice using a gold pan. The sluice will automatically sift through the soil, leaving behind gems and ores for the player to collect.