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 Owner
less arrow which further highlights the incongruity.
Attachments
Comments 3
Steps to Reproduce:
To reproduce with the attached pack installed:
Use the command
/summon minecraft:arrow ~ ~ ~ {"weapon":{"id":"minecraft:bow","components":{"minecraft:enchantments":{"mc_298937:enchantment":1}}}}
above a living entity susceptible to damage (exampleminecraft: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:
We do not have enough information to reproduce this issue.
Please include the following information to help us understand your problem:
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