## Runs from controller.animation.dungeon_spawner.detect
## Runs after doing a check for a mob cap
## @s = ldz:dungeon_spawner

## CHOOSES 1 RANDOM SPAWNER TO KEEP, DESPAWNS THE OTHERS
scoreboard objectives add Spawner dummy

execute as @s[family=main_island_spawner] run function dungeon_spawner/select_main_island_spawner
execute as @s[family=beast_spawner] run function dungeon_spawner/select_beast_spawner
execute as @s[family=mystic_spawner] run function dungeon_spawner/select_mystic_spawner
execute as @s[family=scourge_spawner] run function dungeon_spawner/select_scourge_spawner
execute as @s[family=wraith_spawner] run function dungeon_spawner/select_wraith_spawner

execute at @p run teleport @e[type=ldz:dungeon_spawner] ~ -64 ~

event entity @s despawn


scoreboard objectives add TotalSpawners dummy
#scoreboard objectives setdisplay sidebar TotalSpawners
scoreboard players set .var TotalSpawners 0
execute as @e[type=ldz:dungeon_spawner] run scoreboard players add .var TotalSpawners 1