mojira.dev
MCPE-172530

Event definitions do not work on projectiles

I am trying to create a custom projectile, I want the entity that hit the projectile to have the tag "hit" added, but when I tried to do it and put "affect_target": true, "affect_projectile": false, "affect_shooter": false. the event was still executed to the entity and not to the one that hit.

"on_hit": {
    "impact_damage": {
        "damage": 4,
        "knockback": true
    },
    "remove_on_hit": {},
    "definition_event": {
        "affect_target": true,
        "affect_projectile": false,
        "affect_shooter": false,
        "event_trigger": {
            "event": "spell",
            "target": "self"
        }
    }
}

Comments 4

"affect_target" most likely refers to the entity that was targeted by the shooting mob. This would only work with mobs that shoot at targets they have acquired with targeting behavior components. It would not work with players shooting projectiles since they do not use mob targeting data.

The "on_hit" section defines what happens when the projectile hits (strikes, impacts) a mob. It does not have any effect when the projectile is hit (deflected) by a player or slime block. I don't think it is possible to run events from the projectile component when it is deflected.

Does this explain your issue?

Would mob targeting data have anything to do with affect_shooter? I've found that setting "affect_shooter" to true doesn't execute the event on the shooter like I'd expect.

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please provide an addon showcasing the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

SnowBerry

(Unassigned)

Unconfirmed

Multiple

1.20.1 Hotfix

Retrieved