execute if block ~ ~-1 ~ #dirt run setblock ~ ~-1 ~ rooted_dirt
execute if data entity @s {Item:{id:"minecraft:potato"}} run setblock ~ ~ ~ potatoes
execute if data entity @s {Item:{id:"minecraft:carrot"}} run setblock ~ ~ ~ carrots
data remove entity @s Item
playsound minecraft:block.composter.ready block @a ~ ~ ~ .5 .9