I am attempting to create arrows that summon lightning once when they hit the ground. I got this working, however, I want this to only occur when a particular player fires an arrow. I got this concept to work with items instead of arrows by applying a custom tag with /give @p arrow{customTag:lightning}
. Then when the arrow is thrown on the ground, lightning is summoned by a repeating command block with /execute at @e[nbt={OnGround:1b,Item:{tag:{customTag:lightning}}}] run summon lightning ~ ~ ~
and the item is killed with /kill @e[nbt={OnGround:1b,Item:{tag:{customTag:lightning}}}]
in a chain command block.
I then tried to replicate this process with arrows fired from a bow instead of arrows dropped on the ground. However, I found out that the customTag is not preserved when the arrow is fired. All nbt tags appear to disappear once the arrow becomes a projectile. Is there any way to apply a customTag or other nbt tag to an arrow when it is an item that stays with the arrow even once it is fired from a bow.