execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:wooden_sword"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/wooden/sword
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:wooden_axe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/wooden/axe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:wooden_hoe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/wooden/hoe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:wooden_pickaxe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/wooden/pickaxe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:wooden_shovel"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/wooden/shovel
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:stone_sword"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/stone/sword
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:stone_axe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/stone/axe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:stone_hoe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/stone/hoe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:stone_pickaxe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/stone/pickaxe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:stone_shovel"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/stone/shovel
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:iron_sword"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/iron/sword
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:iron_axe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/iron/axe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:iron_hoe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/iron/hoe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:iron_pickaxe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/iron/pickaxe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:iron_shovel"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/iron/shovel
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:golden_sword"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/golden/sword
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:golden_axe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/golden/axe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:golden_hoe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/golden/hoe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:golden_pickaxe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/golden/pickaxe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:golden_shovel"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/golden/shovel
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:diamond_sword"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/diamond/sword
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:diamond_axe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/diamond/axe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:diamond_hoe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/diamond/hoe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:diamond_pickaxe"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/diamond/pickaxe
execute at @s if block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,id:"minecraft:diamond_shovel"}]} unless block ~ ~ ~ minecraft:trapped_chest{Items:[{Slot:10b,tag:{AttributeModifiers:[{}]}}]} run loot replace block ~ ~ ~ container.10 loot next_level:tools/diamond/shovel




execute at @s run summon minecraft:item ~ ~ ~ {Tags:["UI_Enchant"],Item:{id:"minecraft:barrier",Count:1b}}
execute at @s run tp @e[tag=UI_Enchant,limit=1,sort=nearest] ~ ~1 ~
execute at @s as @e[distance=..1,tag=UI_Enchant,limit=1] run data modify entity @s Item set from block ~ ~ ~ Items.[{Slot:10b}]
execute at @s as @e[distance=..1,tag=UI_Enchant,limit=1] at @s run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/roll_enchantment
execute as @e[tag=UI_Enchant,limit=1,nbt={Item:{id:"minecraft:book"}}] run data merge entity @s {Item:{tag:{display:{Name:"{\"text\":\"Emerald Book\",\"color\":\"green\",\"italic\":false}"}}}}
execute as @e[tag=UI_Enchant,limit=1,nbt={Item:{id:"minecraft:book"}}] run data modify entity @s Item.id set value "minecraft:enchanted_book"
execute at @s as @e[distance=..1,tag=UI_Enchant,limit=1] unless entity @s[nbt={Item:{tag:{nl_Has_Slot1_Enchantment:1b}}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/invalid_input
tag @e[tag=UI_Enchant] remove UI_Enchant
execute at @s run replaceitem block ~ ~ ~ container.10 air
