execute unless entity @n[distance=..3,tag=necromancer_summon] run title @s actionbar {"color":"red", "text": "No valid summons nearby!"}
execute unless entity @n[distance=..3,tag=necromancer_summon] run playsound entity.arrow.hit_player master @s ~ ~ ~ 1 0.5
execute unless entity @n[distance=..3,tag=necromancer_summon] run give @s minecraft:bone[minecraft:custom_name='{"italic":false,"text":"[ Soul of Burrowing ]"}',minecraft:lore=['{"color":"gray","italic":false,"text":"[","extra":[{"color":"dark_green","bold":false,"italic":false,"keybind":"key.use"},{"color":"gray","italic":false,"text":"] on a Gravemite summon to evolve it into a Gravemite Lurker."}]}',"{\"color\":\"gray\",\"italic\":false,\"text\":\"[\",\"extra\":[{\"color\":\"dark_green\",\"bold\":false,\"italic\":false,\"keybind\":\"key.sneak\"},{\"color\":\"gray\",\"italic\":false,\"text\":\" + \"},{\"color\":\"dark_green\",\"bold\":false,\"italic\":false,\"keybind\":\"key.use\"},{\"color\":\"gray\",\"italic\":false,\"text\":\"] to burrow the closest summoned Gravemite Lurker.\"}]}",'{"text":""}','{"color":"gray","italic":false,"text":"Upgrades:"}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"white","bold":false,"italic":false,"text":"+3 Armor"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"green","bold":false,"italic":false,"text":"-1 Scale"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"blue","bold":false,"italic":false,"text":"+0.15 Movement Speed"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"+2 Attack Damage"}]}','{"color":"#9620b6","italic":false,"text":"[ SKILL ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"This entity gains the ability to burrow underground."}]}','{"color":"#9620b6","italic":false,"text":"[ SKILL ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"While underground, create ripples of evoker fangs on the surface."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Existing weapons and armors will be carried over."}'],minecraft:rarity=rare,minecraft:enchantment_glint_override=true,minecraft:custom_data={necromancer_soul_of_burrowing:1b,necromancer_soul_upgrade:1b},minecraft:consumable={consume_seconds:0,animation:none,sound:"minecraft:entity.phantom.bite",has_consume_particles:false},minecraft:item_model="minecraft:ender_eye"] 1

execute if entity @n[distance=..3,tag=gravemite_evolved] run title @s actionbar {"color":"red", "text": "This summon has already evolved!"}
execute if entity @n[distance=..3,tag=gravemite_evolved] run playsound entity.arrow.hit_player master @s ~ ~ ~ 1 0.5
execute if entity @n[distance=..3,tag=gravemite_evolved] run give @s minecraft:bone[minecraft:custom_name='{"italic":false,"text":"[ Soul of Burrowing ]"}',minecraft:lore=['{"color":"gray","italic":false,"text":"[","extra":[{"color":"dark_green","bold":false,"italic":false,"keybind":"key.use"},{"color":"gray","italic":false,"text":"] on a Gravemite summon to evolve it into a Gravemite Lurker."}]}',"{\"color\":\"gray\",\"italic\":false,\"text\":\"[\",\"extra\":[{\"color\":\"dark_green\",\"bold\":false,\"italic\":false,\"keybind\":\"key.sneak\"},{\"color\":\"gray\",\"italic\":false,\"text\":\" + \"},{\"color\":\"dark_green\",\"bold\":false,\"italic\":false,\"keybind\":\"key.use\"},{\"color\":\"gray\",\"italic\":false,\"text\":\"] to burrow the closest summoned Gravemite Lurker.\"}]}",'{"text":""}','{"color":"gray","italic":false,"text":"Upgrades:"}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"white","bold":false,"italic":false,"text":"+3 Armor"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"green","bold":false,"italic":false,"text":"-1 Scale"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"blue","bold":false,"italic":false,"text":"+0.15 Movement Speed"}]}','{"color":"#d79e2b","italic":false,"text":"[ STAT ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"+2 Attack Damage"}]}','{"color":"#9620b6","italic":false,"text":"[ SKILL ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"This entity gains the ability to burrow underground."}]}','{"color":"#9620b6","italic":false,"text":"[ SKILL ] ","extra":[{"color":"gray","bold":false,"italic":false,"text":"While underground, create ripples of evoker fangs on the surface."}]}','{"text":""}','{"color":"gray","italic":false,"text":"Existing weapons and armors will be carried over."}'],minecraft:rarity=rare,minecraft:enchantment_glint_override=true,minecraft:custom_data={necromancer_soul_of_burrowing:1b,necromancer_soul_upgrade:1b},minecraft:consumable={consume_seconds:0,animation:none,sound:"minecraft:entity.phantom.bite",has_consume_particles:false},minecraft:item_model="minecraft:ender_eye"] 1

tag @n[distance=..3,limit=1,type=silverfish,tag=gravemite,tag=!gravemite_evolved] add gravemite_lurker
tag @n[distance=..3,limit=1,type=silverfish,tag=gravemite,tag=!gravemite_evolved] add gravemite_lurker_not_burrowed
attribute @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] armor modifier add necromancer_gravemite_lurker_armor 3 add_value
attribute @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] scale modifier add necromancer_gravemite_lurker_scale -1 add_value
attribute @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] movement_speed modifier add necromancer_gravemite_lurker_movement_speed 0.15 add_value
attribute @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] attack_damage modifier add necromancer_gravemite_lurker_attack_damage 2 add_value
data merge entity @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] {CustomName:'{"text":"[ Gravemite Lurker ]"}'}
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run particle minecraft:dust_pillar{block_state:dirt} ~ ~ ~ 1.5 0 1.5 1 150
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run particle minecraft:sculk_soul ~ ~1 ~ 0.5 0.8 0.5 0.2 25
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run particle minecraft:explosion ~ ~1 ~ 0.5 0.8 0.5 0.2 15
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run playsound minecraft:entity.phantom.hurt master @a[distance=..64] ~ ~ ~ 1 0
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run playsound minecraft:entity.strider.death master @a[distance=..64] ~ ~ ~ 1 0
execute as @n[distance=..3,limit=1,tag=gravemite_lurker,tag=!gravemite_evolved] at @s run playsound minecraft:entity.fox.aggro master @a[distance=..64] ~ ~ ~ 1 0
tag @n[distance=..3,limit=1,type=silverfish,tag=gravemite_lurker] add gravemite_evolved
