
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:0b}]} run replaceitem block ~ ~ ~ container.0 minecraft:wooden_sword{display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},HideFlags:63,CustomModelData:1412001,nl_UI:1b}

execute if block ~ ~ ~ trapped_chest{Items:[{Slot:0b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:0b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_0
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:1b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:1b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_1
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:5b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:5b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_5
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:6b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:6b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_6
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:7b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:7b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_7
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:8b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:8b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_8
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:9b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:9b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_9
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:10b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:10b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_9

execute if block ~ ~ ~ trapped_chest{Items:[{Slot:14b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:14b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_14
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:15b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:15b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_15

execute if block ~ ~ ~ trapped_chest{Items:[{Slot:16b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:16b,tag:{nl_ValidRecipe:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_16

execute if block ~ ~ ~ trapped_chest{Items:[{Slot:17b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:17b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_17
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:18b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:18b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_18
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:19b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:19b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_19

execute if block ~ ~ ~ trapped_chest{Items:[{Slot:23b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:23b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_23
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:24b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:24b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_24
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:25b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:25b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_25
execute if block ~ ~ ~ trapped_chest{Items:[{Slot:26b}]} unless block ~ ~ ~ trapped_chest{Items:[{Slot:26b,tag:{nl_UI:1b}}]} run function next_level:custom_blocks/global/spit_out/slot_26

execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:1b}]} run replaceitem block ~ ~ ~ container.1 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}

execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:5b}]} run replaceitem block ~ ~ ~ container.5 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:6b}]} run replaceitem block ~ ~ ~ container.6 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:7b}]} run replaceitem block ~ ~ ~ container.7 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:8b}]} run replaceitem block ~ ~ ~ container.8 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:9b}]} run replaceitem block ~ ~ ~ container.9 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:10b}]} run replaceitem block ~ ~ ~ container.10 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}

execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:14b}]} run replaceitem block ~ ~ ~ container.14 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:15b}]} run replaceitem block ~ ~ ~ container.15 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}

execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:17b}]} run replaceitem block ~ ~ ~ container.17 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:18b}]} run replaceitem block ~ ~ ~ container.18 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:19b}]} run replaceitem block ~ ~ ~ container.19 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}

execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:23b}]} run replaceitem block ~ ~ ~ container.23 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:24b}]} run replaceitem block ~ ~ ~ container.24 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:25b}]} run replaceitem block ~ ~ ~ container.25 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}
execute unless block ~ ~ ~ trapped_chest{Items:[{Slot:26b}]} run replaceitem block ~ ~ ~ container.26 minecraft:structure_block{CustomModelData:1412002,display:{Name:'{"text":"Use to craft recipes in:","color":"gray"}',Lore:['{"text":"⚔ Minecraft:Next Level ⚔  ","color":"gray"}']},nl_UI:1b}

execute store result score @s nl.Slot1 run data get block ~ ~ ~ Items.[{Slot:2b}].Count
execute store result score @s nl.Slot2 run data get block ~ ~ ~ Items.[{Slot:3b}].Count
execute store result score @s nl.Slot3 run data get block ~ ~ ~ Items.[{Slot:4b}].Count
execute store result score @s nl.Slot4 run data get block ~ ~ ~ Items.[{Slot:11b}].Count
execute store result score @s nl.Slot5 run data get block ~ ~ ~ Items.[{Slot:12b}].Count
execute store result score @s nl.Slot6 run data get block ~ ~ ~ Items.[{Slot:13b}].Count
execute store result score @s nl.Slot7 run data get block ~ ~ ~ Items.[{Slot:20b}].Count
execute store result score @s nl.Slot8 run data get block ~ ~ ~ Items.[{Slot:21b}].Count
execute store result score @s nl.Slot9 run data get block ~ ~ ~ Items.[{Slot:22b}].Count

execute as @s[tag=nl_Craft.ValidRecipe] at @s run function next_level:custom_blocks/gemstone_crafter/craft
execute at @s[tag=nl_Craft.Empty] run function next_level:custom_blocks/gemstone_crafter/recipes

execute at @s[tag=nl_Craft.Empty] if block ~ ~ ~ trapped_chest{Items:[{Slot:16b,tag:{nl_ValidRecipe:1b}}]} run replaceitem block ~ ~ ~ container.16 minecraft:air 

# craft item #

execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:diamond_sword{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:diamond_pickaxe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:diamond_axe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:diamond_shovel{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:diamond_hoe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:iron_sword{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:iron_pickaxe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:iron_axe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:iron_shovel{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:iron_hoe{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:bow{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:shield{nl_ValidRecipe:1b} 0

execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:leather_helmet{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:leather_chestplate{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:leather_leggings{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:leather_boots{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:carved_pumpkin{nl_ValidRecipe:1b} 0

execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:suspicious_stew{nl_ValidRecipe:1b} 0

execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:blaze_rod{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:compass{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:clock{nl_ValidRecipe:1b} 0
execute as @a[scores={nl.CraftID=..0}] store result score @s nl.CraftID run clear @s minecraft:carrot_on_a_stick{nl_ValidRecipe:1b} 0


execute as @a[scores={nl.CraftID=1..}] at @s run function next_level:give/craft_item