## 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_chef_target_5] run event entity @e[type=ldz:teleport_pad,family=beast_pad_dungeon] set_powered_to_true
execute as @s[family=ender_chef_target_6] at @e[type=ldz:ender_chef] run particle ldz:vanilla_teleport ~ ~1 ~
execute as @s[family=ender_chef_target_6] at @e[type=ldz:ender_chef] run playsound ui.teleport.out @a ~ ~ ~ 5
execute as @s[family=ender_chef_target_6] run event entity @e[type=ldz:ender_chef] despawn

## SPAWN NEW TRADE VERSION
execute as @s[family=ender_chef_target_6] run scoreboard objectives remove PChef
execute as @s[family=ender_chef_target_6] run scoreboard objectives add PChef dummy
execute as @s[family=ender_chef_target_6] run summon ldz:ender_chef ~ ~20 ~ 0 0 add_trader
execute as @s[family=ender_chef_target_6] run event entity @e[type=ldz:ender_chef] add_duplication_check_toggle
execute as @s[family=ender_chef_target_6] run scoreboard players add @e[type=ldz:ender_chef,family=ender_trader,c=1] PChef 1
execute as @s[family=ender_chef_target_6] run teleport @e[type=ldz:ender_chef] 100 149 11


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