# Run from: animation.overworld_enderman_spawner.check_bounds
# Run as: @s = overworld_enderman_spawner
# This will despawn the enderman_spawner if it is near a player or inside a dungeon

## Near Player
execute if entity @p[r=20] run tag @s add DontSpawn
## Near MainIsland
tag @s[x=104,y=117,z=31,r=100] add DontSpawn
## Near Beast Dungeon
tag @s[x=95,y=153,z=-467,r=100] add DontSpawn
## Near Mystic Dungeon
tag @s[x=-536,y=172,z=-173,r=100] add DontSpawn
## Near Scourge Dungeon
tag @s[x=23,y=165,z=435,r=100] add DontSpawn
## Near Wraith Dungeon
tag @s[x=565,y=165,z=50,r=100] add DontSpawn

event entity @s[tag=!DontSpawn] transform_into_random
event entity @s[tag=DontSpawn] despawn