## Runs when the mob comes in contact with it - used for moving a mob into place
## Runs from controller.animation.ender_target.reached
## @s = ldz:ender_target

difficulty normal

execute as @s[family=ender_gardener_target_4] run event entity @e[type=ldz:teleport_pad,family=scourge_pad_dungeon] set_powered_to_true
execute as @s[family=ender_gardener_target_5] at @e[type=ldz:ender_gardener] run particle ldz:vanilla_teleport ~ ~1 ~
execute as @s[family=ender_gardener_target_5] at @e[type=ldz:ender_gardener] run playsound ui.teleport.out @a ~ ~ ~ 5
execute as @s[family=ender_gardener_target_5] run event entity @e[type=ldz:ender_gardener] despawn

## SPAWN NEW TRADE VERSION
execute as @s[family=ender_gardener_target_5] run scoreboard objectives remove PGardener
execute as @s[family=ender_gardener_target_5] run scoreboard objectives add PGardener dummy
execute as @s[family=ender_gardener_target_5] run summon ldz:ender_gardener ~ ~20 ~ 0 0 add_trader
execute as @s[family=ender_gardener_target_5] run event entity @e[type=ldz:ender_gardener] add_duplication_check_toggle
execute as @s[family=ender_gardener_target_5] run scoreboard players add @e[type=ldz:ender_gardener,family=ender_trader,c=1] PGardener 1
execute as @s[family=ender_gardener_target_5] run teleport @e[type=ldz:ender_gardener] 108 149 51


execute as @a[tag=dev] run say ender gardener reached target
event entity @s despawn