execute as @e[type=item,nbt={Item:{id:"minecraft:torch",count:1},OnGround:1b}] at @s unless entity @e[type=player,distance=..5] if block ~ ~ ~ #air run tag @s add torching
execute as @e[tag=torching] at @s if block ~ ~ ~ #air unless block ~ ~-.1 ~ #survivalplus:nobounce run setblock ~ ~ ~ torch

execute as @e[type=item,nbt={Item:{id:"minecraft:soul_torch",count:1},OnGround:1b}] at @s unless entity @e[type=player,distance=..5] if block ~ ~ ~ #air run tag @s add torching
execute as @e[tag=torching] at @s if block ~ ~ ~ #air unless block ~ ~-.1 ~ #survivalplus:nobounce run setblock ~ ~ ~ soul_torch

execute as @e[type=item,nbt={Item:{id:"minecraft:redstone_torch",count:1},OnGround:1b}] at @s unless entity @e[type=player,distance=..5] if block ~ ~ ~ #air run tag @s add torching
execute as @e[tag=torching] at @s if block ~ ~ ~ #air unless block ~ ~-.1 ~ #survivalplus:nobounce run setblock ~ ~ ~ redstone_torch

execute at @e[tag=torching] run playsound minecraft:block.wood.place block @a ~ ~ ~ 1 .9
execute as @e[tag=torching] on origin run advancement grant @s only survivalplus:adventure/misc/autotorch
kill @e[tag=torching]