How can you summon/create player shot arrows using commands?



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



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




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2