#what even are entity tags, amirite fellow kids?
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=chicken] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=sheep] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=pig] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=cow] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=horse] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=minecraft:mooshroom] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=rabbit] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=llama] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=squid] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=panda] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=fox] add FarmCap
execute at @s[tag=AnimalSpell2,tag=!FarmReset] positioned ~ ~ ~ run tag @e[distance=..15,type=squid] add FarmCap
tag @a remove FarmCapCheck
tag @s[tag=AnimalSpell2,tag=!FarmReset,level=3..,nbt={Inventory:[{id:"minecraft:egg"}]},tag=!FarmUpgrade2] add FarmCapCheck
tag @s[tag=AnimalSpell2,tag=!FarmReset,tag=FarmUpgrade2] add FarmCapCheck
tellraw @s[tag=AnimalSpell2,tag=!FarmCapCheck] ["",{"text":"You need at least an egg and 3 levels to cast this!","color":"yellow"}]
execute at @s[tag=FarmCapCheck] run tag @e[sort=nearest,limit=1,tag=FarmCap,distance=..20] add CaptureMe
execute at @e[type=chicken,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:chicken_spawn_egg",Count:1b}}
execute at @e[type=sheep,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:sheep_spawn_egg",Count:1b}}
execute at @e[type=pig,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:pig_spawn_egg",Count:1b}}
execute at @e[type=cow,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:cow_spawn_egg",Count:1b}}
execute at @e[type=horse,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:horse_spawn_egg",Count:1b}}
execute at @e[type=mooshroom,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:mooshroom_spawn_egg",Count:1b}}
execute at @e[type=rabbit,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:rabbit_spawn_egg",Count:1b}}
execute at @e[type=llama,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:llama_spawn_egg",Count:1b}}
execute at @e[type=panda,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:panda_spawn_egg",Count:1b}}
execute at @e[type=squid,tag=CaptureMe] run execute at @p[tag=AnimalSpell2,distance=..20,tag=FarmCapCheck] run summon item ~ ~ ~ {Item:{id:"minecraft:squid_spawn_egg",Count:1b}}
xp add @s[tag=AnimalSpell2,tag=FarmCapCheck,tag=!FarmUpgrade2] -27 points
clear @s[tag=AnimalSpell2,tag=FarmCapCheck,tag=!FarmUpgrade2] egg 1
tellraw @s[tag=AnimalSpell2,tag=FarmReset] ["",{"text":"You have already used this spell recently - You may use it again soon.","color":"yellow"}]
playsound minecraft:entity.chicken.egg ambient @s[tag=AnimalSpell2,tag=FarmCapCheck] ~ ~ ~ 1 1 1
scoreboard players set @s KyuSpells 0
tp @e[tag=CaptureMe] ~ ~-500 ~