
# -> If current block is not a stonecutter then remove
execute unless block ~ ~ ~ stonecutter run \
    return run \
        kill @s

# -> If there is an entity above the stonecutter then damage it
execute align xyz run \
    damage @n[type=!#overly_realistic:no_ai,dx=0,dy=0,dz=0] 6.0 generic

# -> If block above isn't special then return
execute unless block ~ ~1 ~ #overly_realistic:can_be_processed_by_stonecutter run \
    return fail

# -> Add to CutBlockTime
scoreboard players add @s OverlyRealistic.World.StonecutterCutBlockTime 1

# -> If CutBlockTime < max then return
execute unless score @s OverlyRealistic.World.StonecutterCutBlockTime matches 3.. run \
    return fail

# -> Reset CutBlockTime
scoreboard players reset @s OverlyRealistic.World.StonecutterCutBlockTime

# -> Get block type
item replace entity 00000001-0000-002b-0000-00010000002b contents with stick
loot replace entity 00000001-0000-002b-0000-00010000002b contents mine ~ ~1 ~ netherite_pickaxe[enchantments={silk_touch:1},custom_data={CanBreakLogs:1b}]
execute if items entity 00000001-0000-002b-0000-00010000002b contents stick run \
    loot replace entity 00000001-0000-002b-0000-00010000002b contents mine ~ ~1 ~ netherite_axe

#tellraw @a {entity:"00000001-0000-002b-0000-00010000002b",nbt:"item.id"}

# -> Store the name of the block above
data modify storage overly_realistic:temp_values temp_string_0 set string entity 00000001-0000-002b-0000-00010000002b item.id 10

#tellraw @a {storage:"overly_realistic:temp_values",nbt:"temp_string_0"}

# -> Add to cut value
scoreboard players add @s OverlyRealistic.General.ArbitraryData 1

# -> Operate on block
function overly_realistic:general/stonecutters/cut_block_above with storage overly_realistic:temp_values
