
# -> Check for torches
execute if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~ ~1 ~ \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~ ~-1 ~ \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~1 ~ ~ \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~ ~ ~1 \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~-1 ~ ~ \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}
execute positioned ~ ~ ~-1 \
    if block ~ ~ ~ #overly_realistic:torches \
    align xyz \
    positioned ~0.5 ~0.5 ~0.5 \
    unless entity @n[type=marker,tag=OverlyRealistic.TorchBlock,distance=..0.1] run \
        return run \
            summon marker ~ ~ ~ {Tags:["OverlyRealistic.TorchBlock","OverlyRealistic.Block.IsPlacedBlockMarker"]}

# -> Debug
#particle flame ~ ~ ~ 0 0 0 0.0001 1 force @a

# -> Increment raycast
scoreboard players add #or.Raycast.RayRange OverlyRealistic.General.ArbitraryData 1

# -> Loop
execute unless score #or.Raycast.RayRange OverlyRealistic.General.ArbitraryData >= #or.Raycast.RayRangeMax OverlyRealistic.General.ArbitraryData \
    positioned ^ ^ ^0.5 run \
        function overly_realistic:players/block_placement/torch_placement/raycast_travel