How do I restrict the generation of my blocks to only those above the grass or soil? (1.21.1)

I wish they would only appear above land and above water.

Continue to help post