scoreboard players add @s En 1
execute at @s[scores={En=10}] run particle dust 0 0.635 1 1 ^ ^1 ^0.3 0.3 0.3 0.3 0.1 10 force
item replace entity @s[tag=!aaa,scores={En=3..}] weapon from entity @p[nbt={Inventory:[{Slot:-106b,tag:{fly:1}}]}] weapon.offhand
item replace entity @s[tag=!aaa,scores={En=3..}] weapon from entity @p[nbt={SelectedItem:{tag:{fly:1}}}] weapon.mainhand
#tp @s[tag=!fly1,tag=!fly2,tag=!fly22,tag=!fh] ^0.2 ^ ^0.8 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=2..]



#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f1] ^2.2 ^0.5 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f2] ^2.2 ^0.6 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f3] ^2.2 ^0.7 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f4] ^2.2 ^0.8 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f5] ^2.2 ^0.9 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
#execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f6] ^2.2 ^1 ^2 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]

execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f1] ^1.7 ^0.5 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f2] ^1.7 ^0.6 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f3] ^1.7 ^0.7 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f4] ^1.7 ^0.8 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f5] ^1.7 ^0.9 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]
execute positioned ~ ~-1 ~ if entity @s[tag=fly1] run tp @s[tag=fly1,tag=!fly2,tag=!fly22,tag=f6] ^1.7 ^1 ^1.7 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}}]


execute at @s[tag=!fly1,tag=!fly2,tag=!fly22] rotated as @p[nbt={SelectedItem:{tag:{fly:1}}}] run tp @s ~ ~ ~ ~ ~
execute at @s[tag=!fly1,tag=!fly2,tag=!fly22,scores={En=5..}] at @p[nbt={SelectedItem:{tag:{fly:1}}}] run function aop1:flytp

execute at @s[tag=fly2] rotated as @p[nbt={SelectedItem:{tag:{fly:1}}}] run tp @s ^ ^ ^2
execute at @s[tag=fly22] rotated as @p[nbt={SelectedItem:{tag:{fly:1}}}] run tp @s[tag=fly22] ^ ^ ^3.5


execute at @s[tag=!f1,tag=!f2,tag=!f3,tag=!f4,tag=!f5,tag=!f6,tag=!f7,tag=!f8,tag=!f9,tag=!f10,tag=!f11,tag=!f12,tag=!f13,tag=!f14,tag=!f15,tag=!f16,tag=!f17,tag=!f18,tag=!f19,tag=!f20,tag=!f21,tag=!f22,tag=!f23,tag=!f24,tag=!f25,tag=!f26,tag=!f27,tag=!f28,tag=!f29,tag=!f30,tag=!f31] run function aop1:addtag
execute at @s[tag=fly1] at @e[nbt=!{SelectedItem:{tag:{fly:1}}},tag=!fly,distance=..2,type=!item,type=!experience_orb] run particle sweep_attack ~ ~1.5 ~ 0.5 0.5 0.5 0.5 1 force @a
execute at @s[tag=fly2] at @e[nbt=!{SelectedItem:{tag:{fly:1}}},tag=!fly,distance=..2,type=!item,type=!experience_orb] run particle sweep_attack ~ ~1.5 ~ 0.5 0.5 0.5 0.5 1 force @a
execute at @s[tag=fly22] at @e[nbt=!{SelectedItem:{tag:{fly:1}}},tag=!fly,distance=..2,type=!item,type=!experience_orb] run particle sweep_attack ~ ~1.5 ~ 0.5 0.5 0.5 0.5 1 force @a
#


#particle dust 0.071 0.831 1 1 ^-0.2 ^0.8 ^1.2 0.2 0.2 0.2 0.1 1 force @a
execute at @s[tag=fly1] run data merge entity @s {Pose:{RightArm:[0f,180f,270f]}}
execute at @s[tag=!fly1] run data merge entity @s {Pose:{RightArm:[0f,0f,0f]}}
execute at @s[tag=fly22] run data merge entity @s {Pose:{RightArm:[350f,0f,0f]}}
#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=2..] if predicate aop1:ran6 run tp @s[tag=!fly1] ^-0.1 ^ ^1 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=2..]

#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=2..] if predicate aop1:ran6 run tp @s[tag=!fly1] ^0.1 ^ ^1 facing entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=2..]
execute at @s[tag=fly22] run playsound entity.drowned.shoot voice @a ~ ~ ~ 1 1
execute at @s[tag=fly2] run playsound entity.drowned.shoot voice @a ~ ~ ~ 1 1

#tp @s[tag=f1,tag=flyk] ^-1.5 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 
#tp @s[tag=f2,tag=flyk] ^-1.3 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 
#tp @s[tag=f3,tag=flyk] ^-1.8 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 
#tp @s[tag=f4,tag=flyk] ^1.7 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 
#tp @s[tag=f5,tag=flyk] ^1.2 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 
#tp @s[tag=f6,tag=flyk] ^1.4 ^ ^3 facing entity @e[scores={sw2=2..},limit=1,sort=nearest] 

#execute if entity @e[scores={sw2=2..},distance=..1.4] run tag @s remove flyk

scoreboard players add @s lol 1
execute at @s[tag=fly2] at @e[type=ender_dragon,distance=..5] run summon tnt
execute at @s[tag=fly2] at @e[type=wither,distance=..5] run summon tnt

execute at @s[tag=fly2] run effect give @e[distance=..2,nbt=!{SelectedItem:{tag:{fly:1}}},tag=type1,type=!armor_stand] instant_damage 1 1 true
execute at @s[tag=fly2] run effect give @e[distance=..2,nbt=!{SelectedItem:{tag:{fly:1}}},tag=type2,type=!armor_stand] instant_health 1 1 true

execute at @s[tag=fly22] run effect give @e[distance=..2,nbt=!{SelectedItem:{tag:{fly:1}}},tag=type1,type=!armor_stand] instant_damage 1 1 true
execute at @s[tag=fly22] run effect give @e[distance=..2,nbt=!{SelectedItem:{tag:{fly:1}}},tag=type2,type=!armor_stand] instant_health 1 1 true
scoreboard players reset @s[scores={lol=10..}] lol


#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=..2] if predicate aop1:ran6 run tp @s[tag=!fly1] ^ ^ ^0.015
#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=..2] if predicate aop1:ran6 run tp @s[tag=!fly1] ^ ^ ^-0.015
#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=..2] if predicate aop1:ran6 run tp @s[tag=!fly1] ^0.015 ^ ^
#execute if entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=..2] if predicate aop1:ran6 run tp @s[tag=!fly1] ^-0.015 ^ ^
execute unless entity @p[nbt={SelectedItem:{tag:{fly:1}}},distance=..50] unless entity @p[nbt={Inventory:[{Slot:-106b,tag:{fly:1}}]},distance=..30] run kill @s
tag @s[scores={En=10..}] add aaa