#say custom_blocks:global.mcfunction

clear @s minecraft:structure_block{nl_UI:1b}
clear @s minecraft:wooden_sword{nl_UI:1b}
kill @e[type=minecraft:item,nbt={Item:{tag:{nl_UI:1b}}}]

# Give Custom Blocks #

execute as @s[nbt={Inventory:[{id:"minecraft:structure_block",Count:1b}]}] run function next_level:give/crystal_ball
execute as @s[nbt={Inventory:[{id:"minecraft:knowledge_book",Count:1b}]}] run function next_level:give/emerald_enchanter
execute as @s[nbt={Inventory:[{id:"minecraft:structure_void",Count:1b}]}] run function next_level:give/gemstone_crafter
execute as @s[nbt={Inventory:[{id:"minecraft:jigsaw",Count:1b}]}] run function next_level:give/diamond_anvil

# Custom Blocks: Emerald Enchanter #
execute as @e[type=minecraft:firework_rocket,nbt={FireworksItem:{tag:{nl_Place.Enchanter:1b}}}] run function next_level:custom_blocks/emerald_enchanter/place
execute at @s as @e[type=minecraft:armor_stand,tag=nl_Enchanter,distance=..8] at @s run function next_level:custom_blocks/emerald_enchanter/main

# Custom Blocks: Gemstone Crafter #
execute as @e[type=minecraft:firework_rocket,nbt={FireworksItem:{tag:{nl_Place.Crafter:1b}}}] run function next_level:custom_blocks/gemstone_crafter/place
execute at @s as @e[type=minecraft:armor_stand,tag=nl_Crafter,distance=..8] at @s run function next_level:custom_blocks/gemstone_crafter/main
# Custom Blocks: Crystal Ball #

execute as @e[type=minecraft:firework_rocket,nbt={FireworksItem:{tag:{nl_Place.Crystal:1b}}}] run function next_level:custom_blocks/crystal_ball/place
execute at @s as @e[type=minecraft:armor_stand,tag=nl_Crystal,distance=..8] at @s run function next_level:custom_blocks/crystal_ball/main

# Custom Blocks: Diamond Anvil #
execute as @e[type=minecraft:firework_rocket,nbt={FireworksItem:{tag:{nl_Place.Anvil:1b}}}] run function next_level:custom_blocks/diamond_anvil/place
execute at @s as @e[type=minecraft:armor_stand,tag=nl_Anvil,distance=..8] at @s run function next_level:custom_blocks/diamond_anvil/main
