loot spawn ~ ~ ~ loot next_level:custom_blocks/enchant_roll
execute store result score @s nl.Rng at @s run data get entity @e[type=minecraft:item,distance=..1,limit=1,nbt={Item:{tag:{nl_roll100:1b}}}] Item.tag.AttributeModifiers.[0].Amount
kill @e[limit=1,nbt={Item:{tag:{nl_roll100:1b}}}]

# Swords # 
execute as @s[nbt={Item:{id:"minecraft:wooden_sword"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/sword_enchant
execute as @s[nbt={Item:{id:"minecraft:stone_sword"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/sword_enchant
execute as @s[nbt={Item:{id:"minecraft:iron_sword"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/sword_enchant
execute as @s[nbt={Item:{id:"minecraft:golden_sword"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/sword_enchant
execute as @s[nbt={Item:{id:"minecraft:diamond_sword"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/sword_enchant

# Axes #
execute as @s[nbt={Item:{id:"minecraft:wooden_axe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/axe_enchant
execute as @s[nbt={Item:{id:"minecraft:stone_axe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/axe_enchant
execute as @s[nbt={Item:{id:"minecraft:iron_axe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/axe_enchant
execute as @s[nbt={Item:{id:"minecraft:golden_axe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/axe_enchant
execute as @s[nbt={Item:{id:"minecraft:diamond_axe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/axe_enchant

# Pickaxe #

execute as @s[nbt={Item:{id:"minecraft:wooden_pickaxe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/pickaxe_enchant
execute as @s[nbt={Item:{id:"minecraft:stone_pickaxe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/pickaxe_enchant
execute as @s[nbt={Item:{id:"minecraft:iron_pickaxe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/pickaxe_enchant
execute as @s[nbt={Item:{id:"minecraft:golden_pickaxe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/pickaxe_enchant
execute as @s[nbt={Item:{id:"minecraft:diamond_pickaxe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/pickaxe_enchant

# Shovel #

execute as @s[nbt={Item:{id:"minecraft:wooden_shovel"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/shovel_enchant
execute as @s[nbt={Item:{id:"minecraft:stone_shovel"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/shovel_enchant
execute as @s[nbt={Item:{id:"minecraft:iron_shovel"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/shovel_enchant
execute as @s[nbt={Item:{id:"minecraft:golden_shovel"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/shovel_enchant
execute as @s[nbt={Item:{id:"minecraft:diamond_shovel"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/shovel_enchant

# Hoe # 

#execute as @s[nbt={Item:{id:"minecraft:wooden_hoe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/hoe_enchant
#execute as @s[nbt={Item:{id:"minecraft:stone_hoe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/hoe_enchant
#execute as @s[nbt={Item:{id:"minecraft:iron_hoe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/hoe_enchant
#execute as @s[nbt={Item:{id:"minecraft:golden_hoe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/hoe_enchant
#execute as @s[nbt={Item:{id:"minecraft:diamond_hoe"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/hoe_enchant

# Bow #

#execute as @s[nbt={Item:{id:"minecraft:bow"}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/bow_enchant

# books # 

#execute as @s[nbt={Item:{id:"minecraft:book"}}] unless entity @s[nbt={Item:{tag:{nl_Has_Slot1_Enchantment:1b}}}] run function next_level:custom_blocks/emerald_enchanter/enchant_slot1/tools/other_enchant