tag @s add process

execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:stone[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:granite"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:granite[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:diorite"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:diorite[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:andesite"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:andesite[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:gravel"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:gravel[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:sand"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:sand[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:red_sand"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:red_sand[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:tuff"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:tuff[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:basalt"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:basalt[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:deepslate"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:deepslate[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:dripstone_block"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:dripstone_block[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:calcite"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:calcite[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:blackstone"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:blackstone[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:netherrack"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:netherrack[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:end_stone"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:end_stone[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:obsidian"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:obsidian[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:flint"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:flint[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:coal"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:coal[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:raw_copper"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:raw_copper[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:raw_iron"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:raw_iron[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:raw_gold"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:raw_gold[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:emerald"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:emerald[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:amethyst_shard"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:amethyst_shard[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:quartz"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:quartz[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:prismarine_shard"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:prismarine_shard[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:prismarine_crystals"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:prismarine_crystals[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:lapis_lazuli"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:lapis_lazuli[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:diamond"}}
execute store success score @s item_count if items entity @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] container.* minecraft:diamond[!minecraft:custom_data] run summon minecraft:item ~ ~ ~ {Item:{id:"minecraft:netherite_scrap"}}

execute if score @s item_count matches 1.. run playsound minecraft:block.enchantment_table.use block @a ~ ~ ~ 1 1
execute if score @s item_count matches 1.. run playsound minecraft:item.totem.use block @a ~ ~ ~ 1 2
execute if score @s item_count matches 1.. run particle minecraft:flash{color:[1,1,1,0]}
execute if score @s item_count matches 1.. run particle minecraft:totem_of_undying ~ ~ ~ 0 0 0 0.5 50
execute if score @s item_count matches 1.. run particle minecraft:glow ~ ~ ~ 0 0 0 1 50

execute if score @s item_count matches 1.. as @e[nbt={Item:{count:2}},type=minecraft:item,distance=..0.2] if items entity @s container.* #alelchem:convertable[!minecraft:custom_data] unless items entity @s container.* minecraft:netherite_scrap run kill @s
execute if score @s item_count matches 1.. run kill @s

tag @s remove process