Code for 1.18.2 that registers a BlockTag LootItemCondition.
https://forums.minecraftforge.net/topic/113816-1182-method-for-iterating-over-blocks-belonging-to-a-tag/#comment-505993
It should be the same for 1.19 except If you use the most recent versions of minecraft the ResourceKey is in the Registries class instead of Registry.