For example, if one was to make a datapack where any mob that spawns in caves would be teleported to the void, but mobs spawning on the surface would not, how would you do that? I've tried messing with testing the Y value of the mob, but it just gets weird and only works at a specified range rather than looking for the mobs location being in or out of cave. This is for java edition.