# Mana cast_cost
execute unless predicate items:selected/wand run scoreboard players set @s cast_cost 0
execute if predicate items:selected/wand run function items:wand/0_cast/cost

# Casting
execute if predicate items:selected/wand run function items:wand/0_cast/main

# ======== Click and Keep Selected ========
# Click to start cast -> hold item to keep casting
# Check
tag @s[tag=click_keep,nbt=!{SelectedItem:{tag:{type:wand,use:click_keep}}}] remove click_keep
scoreboard players remove @s[tag=click_keep,scores={ch_cooldown=1..}] ch_cooldown 1
execute if entity @s[tag=click_keep,scores={ch_cooldown=0}] if score @s cast_cost <= @s mana at @s run function items:wand/click_keep/0_sort
