mojira.dev
MC-298937

post_attack enchantment effect component does not trigger for summoned arrows/arrows without Owner

Any enchantments post_attack effects will not be applied if the attacker was an arrow without an Owner.

The minecraft:test enchantment has its post_attack effect component defined as follows:

"minecraft:post_attack": [
  {
    "affected": "victim",
    "enchanted": "attacker",
    "effect": {
      "type": "minecraft:run_function",
      "function": "minecraft:debug"
    }
  }
]

With the function in question just being:

say DEBUG

This enchantment triggers its function effect when:

  • An arrow shot from a bow with the enchantment hits an entity.

  • A trident with the enchantment is thrown and makes contact with an entity.

  • A trident summoned using /summon minecraft:trident ~ ~ ~ {"item":{"id":"minecraft:trident","components":{"minecraft:enchantments":{"minecraft:test":1}}}} hits an entity.

This enchantment fails to trigger its function effect when:

  • An arrow summoned using /summon minecraft:arrow ~ ~ ~ {"weapon":{"id":"minecraft:bow","components":{"minecraft:enchantments":{"minecraft:test":1}}}} hits an entity.

Notably, an arrow summoned using this commend that is then modified using /data modify entity @n[type=minecraft:arrow] Owner set from entity @s UUID and hits an entity after will trigger the effect as expected. This will only work if the used UUID points to a living entity that still exists in the world by the time the projectile hits. In short, this method works using the UUID of an entity like minecraft:pig or minecraft:player but it will fail if the UUID of a minecraft:item instance is used or the entity has died since.

I bring up tridents as a comparison as they do trigger post_attack component effects when summoned like this which leads me to believe that this is the intended behavior. Also somewhat related, other enchantment component effects such as hit_block work without issue and as expected using an Ownerless arrow which further highlights the incongruity.

Attachments

Comments 3

We do not have enough information to reproduce this issue.

Please include the following information to help us understand your problem:

Steps to Reproduce:

  1. (Explain what needs to be done for the issue to happen)

Observed Results:
(Briefly describe what happens)

Expected Results:
(Briefly describe what should happen)

Please also attach any needed commands, add-ons/behavior packs, data packs, resource packs, screenshots, videos, or worlds needed to help reproduce this issue.

Refer to the Bug Tracker Guidelines for more information about how to write helpful bug reports. Bug reports with insufficient information may be closed as Incomplete.

This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
๐Ÿ““ Bug Tracker Guidelines -- ๐Ÿ’ฌ Community Support -- ๐Ÿ“ง Mojang Support (Technical Issues) -- ๐Ÿ“ง Microsoft Support (Account Issues) -- ๐Ÿ““ Project Summary -- โœ๏ธ Feedback and Suggestions -- ๐Ÿ“– Game Wiki

Steps to Reproduce:
To reproduce with the attached pack installed:

  1. Use the command /summon minecraft:arrow ~ ~ ~ {"weapon":{"id":"minecraft:bow","components":{"minecraft:enchantments":{"mc_298937:enchantment":1}}}} above a living entity susceptible to damage (example minecraft:zombie) and have it hit the entity.

Observed Result:
The enchantments minecraft:post_attack effect component fails to trigger its effect.

Expected Result:
The defined minecraft:post_attack effect should write Successfully Triggered Function Effect in the game chat via its function effect.

Additional Information:
Conversely, using a bow with the enchantment (/give @s minecraft:bow[minecraft:enchantments={"mc_298937:enchantment":1}]) to shoot the same entity will trigger the effect as expected.

In the same vein, summoning an arrow with the enchantment and an Owner defined will also trigger the effect when it deals damage so long as the owner is a living entity:

  • /summon minecraft:zombie ~ ~ ~ {UUID:[I;0,0,0,0]}

  • /summon minecraft:arrow ~ ~ ~ {"Owner":[I;0,0,0,0],"weapon":{"id":"minecraft:bow","components":{"minecraft:enchantments":{"mc_298937:enchantment":1}}}}

Datapack for 25w31a, latest development version at time of response:

[media]

Thanks. Iโ€™ve bumped this up to confirmed. I couldnโ€™t get /give @s minecraft:bow{Enchantments:[{id:"mc_298937:enchantment",lvl:1}]} to work ingame but I can confirm that when using the command in step 1, it doesnโ€™t print in chat as expected

Syrenyx

(Unassigned)

Confirmed

(Unassigned)

1.21.6, 1.21.7, 1.21.8, 25w31a

Retrieved