If this is possible, the player who fired the arrow, either by UUID or by username, should be stored somewhere for each arrow.
First I checked the wiki for an arrow entity's NBT data. But as you said, while ThrownEnderpearl
, ThrownExpBottle
, ThrownPotion
, and Snowball
all have an ownerName
field, Arrow
does seem to have anything indicating it would store the player who fired it.
I fired an arrow and checked its NBT in game, as I've noticed the wiki occasionally misses out data tags:
![enter image description here](https://i.stack.imgur.com/BiOm1.png)
But again there was nothing that stored my player ID. (Note that UUIDMost and UUIDLeast are both for identifying the entity itself, not who fired it)
I wanted to see if the data of who shot an arrow persists through the world closing and opening. To do this, I:
- Created a world
- Shot an arrow straight up
- Closed the world
- Opened the world
- Quickly opened the world to LAN
- Logged in with an account that was on survival, positioned directly below the arrow
When the arrow hit the survival player, not only was no ping sound played for hitting a player, but the message in chat simply showed that the player was shot by "Arrow", rather than me:
![enter image description here](https://i.stack.imgur.com/6KQOC.png)
(Note that both players were logged on, the one that shot the arrow and the one that got hit by it)
Because of this, I believe that the player who fired an arrow is not actually stored anywhere in an arrow's data.
Thus the answer to "Is there any way to summon arrows that are shot by a player or mob?" unfortunately seems to simply be no.
I suspect death messages and ping sounds are done temporarily in code, rather than stored anywhere that can be manipulated with commands. They are lost when the world reloads, and are not stored anywhere in the individual arrow's data.
What I would do is summon another ArmorStand under and increment all existing ones within certain range, maybe just those that have same X and Y coordinates.
That way it would not interfere with other existing goalposts.
Alternatively, once you reach ground, lock all existing goalposts (by using another scoreboard objective). When you create new goalpost, you could again summon ArmorStands under and increment the score for those that are not locked yet.
Best Answer
I got this to work:
In a repeating command block:
In a conditional chain command block:
In a regular chain command block:
The
Marker:1
tag gives it a really tiny hitbox, so offsetting it slightly is enough to keep it from getting in the snowball's way. Note that this summons the armor stand with its feet at the snowball, you might want to offset it farther down to get the effect you want.Edit
I may have misunderstood the problem. Were you trying to get a projectile to kill an existing invulnerable armor stand on hit? If so, this is what you want: