mobs spawn only in caves

Status
Resolved
Issue description

im trying to make a mob that only spawns in a cave but am struggling and i cant find an in detail solution, pls help

Issue comments

You can use on entity spawned procedure, check if entity can see sunlight using can see sunlight procedure block from world management and despawn the entity if the condition is not met.