Apologies for the poor explanation on my part. If you want to use a feature, you can't easily use a template. You would need to get it through the StructureTemplateManager through the ServerLevel through the WorldGenLevel, load the data, and then generate it. TelepathicGrunt does have a tutorial on creating a custom structure through which you could use to add an extra spawn check if there is air around you. Though, imo, you're still better off with a feature since you should be able to more safely check whether you can replace the block there.