How do I summon projectiles (specifically snowballs) above mobs in a certain radius when I am holding a certain item?

Solution 1:

it is pretty simple to make it but i have no idea how to make so you need to hold an item with an specific name… this command works so you need to hold any fishing_rod with any type of name to summon arrows over near entitys

put this command in a reapet command block and have it on always active or power it manually when you want to activate the thing

execute as @p[nbt={SelectedItem:{id:"minecraft:fishing_rod",Count:1b}}] run execute at @p run execute at @e[distance=0..10,type=!minecraft:player,type=!minecraft:arrow,type=!minecraft:item] run summon minecraft:arrow ~ ~3 ~

then put this command in a second command block on chain, always active and conditional

kill @e[type=minecraft:arrow,nbt={inGround:1b}]

now when you holding in a fishing_rod it will summon arrows over all near mobs! enjoy