
# -> Replace item
execute if items entity @s[gamemode=!creative] weapon.mainhand *[custom_data~{IsMeltedCopperCrucible:1b}] run \
    loot replace entity @s weapon.mainhand loot overly_realistic:blocks/crucible
execute if items entity @s[gamemode=!creative] weapon.offhand *[custom_data~{IsMeltedCopperCrucible:1b}] \
    unless items entity @s weapon.mainhand *[custom_data~{IsMeltedCopperCrucible:1b}] run \
        loot replace entity @s weapon.offhand loot overly_realistic:blocks/crucible

# -> If there is a hardened clay mold on the ground then place it on the mold
scoreboard players set #or.mold_success OverlyRealistic.General.ArbitraryData 0
execute align xyz \
    as @n[type=interaction,tag=OverlyRealistic.Block.HardenedClayMold,tag=!OverlyRealistic.Block.HardenedClayMold_HasContents,dx=0,dy=0,dz=0] run \
        function overly_realistic:players/items/melted_copper_crucible/place_contents_on_hardened_clay_mold
execute if score #or.mold_success OverlyRealistic.General.ArbitraryData matches 1 run \
    return run \
        advancement grant @s only overly_realistic:advancements/copper_age/molten_arsenal

# -> Set block
execute align xyz run \
    summon marker ~0.5 ~ ~0.5 {Tags:["OverlyRealistic.Block.MeltedCopperCruciblePlacementMarker"]}

# -> Create placement
schedule function overly_realistic:players/items/melted_copper_crucible/block_placement_operate 1t
