7

When killing a player with an arrow, it will come with different death messages depending on who or what shot the arrow:

Dispenser:[player] was shot by arrow
Player/Mob:[player] was shot by [player/mob]
Player/Mob w/ Renamed Bow:[player] was shot by [player/mob] using [bow name]

When a player kills another player in this method, there are events that are triggered such as the killing player's kill count will increase, or when a skeleton's arrow kills a creeper the creeper drops a music disk.

Is there any way to summon arrows that are shot by a player or mob? There is no nbt tag ownerName for arrows, only for thrown ender pearls, snowballs, exp bottle, and potions. If so, how is the shooter stored?

I can simulate the effects of a player/mob shot arrow, i want to know if i could create arrows that straight up is a player/mob shot arrow.

2
  • Not sure if I rephrased the last part correctly, can you confirm this is what you meant to say?
    – MrLemon
    Apr 21, 2015 at 9:52
  • Why do you need the arrow to be shot by a player? If the answer is "To make the kill count increase", then my next question is "Why do you need the kill count to increase?". It would help to know what you are trying to do, not just how you are trying to do it, because there may be a simpler solution to your real problem.
    – Rainbolt
    Apr 21, 2015 at 19:09

3 Answers 3

5
+50

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

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:

  1. Created a world
  2. Shot an arrow straight up
  3. Closed the world
  4. Opened the world
  5. Quickly opened the world to LAN
  6. 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

(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.

3
  • 1
    With a little digging into the source code i can confirm this. With the help of MCP i have found that the class EntityArrow have a variable called shootingEntity of type Entity. This variable is NOT written to nbt in the writeToNBT method, so this data will be lost when the arrow is unloaded either via no player within the vicinity or if the world is exited.
    – Moddl
    Apr 28, 2015 at 23:25
  • This answer will receive the bounty
    – Moddl
    Apr 28, 2015 at 23:25
  • 1
    if you want to update this, as of 1.17 (and possible sooner), all projectiles now have an IntArray value of Owner, which is the UUID of whoever shot/threw it
    – 0xEARTH
    Jul 1, 2021 at 4:59
0

If the item has been shot by a dispenser, then no matter how you set up the arrow, it will still have been fired by a dispenser. Short of editing the code for Minecraft itself, there is no way to change this.

2
  • sorry if this is inapropriate, just tell me and i will remove it Apr 21, 2015 at 19:09
  • This answer is appropriate (it might be wrong, but being wrong doesn't make it inappropriate). The grammar needed some work, but I fixed it for you this time. Consider capitalizing the first letter of each sentence as well as proper nouns like "Minecraft".
    – Rainbolt
    Apr 21, 2015 at 19:14
-1

Here is a command you can use!

/summon Arrow ~ ~ ~ {damage:1,Motion:[0.0,0.0,0.0]}

The command works in game for me.

1
  • 2
    This doesn't really address the question, though, does it? The arrow you mention won't be "fired" by a player.
    – obskyr
    Sep 25, 2016 at 23:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .