The bug
When using the "minecraft:damage_sensor" component and specifying multiple triggers that have the capacity to run multiple events per tick, only the first one listed is applied to its target. Also noteworthy is the lag spike that occurs when the pig is first hit.
Steps to reproduce:
Download the attached behavior pack and apply it to a world.
In the world, summon a pig and punch it. The pig has two triggers in its damage sensor: the first one runs an event on itself, and the second an event on the damager.
Observe chat. You should see a line from both the pig and the player, indicating both events were ran.
→❌ Only the line from the pig is printed, as it was listed first. The player did not receive an event despite meeting the conditions for the trigger.
Additionally, one can rearrange the triggers in the pig's behavior file, or comment out the first trigger, and confirm that the trigger listed first is the one that fires an event.
Thank you for your report!
However, this issue has been closed as Working as Intended.
Some information from the team:
"minecraft:damage_sensor" has always checked through its triggers until the first one matches, then it fires that event and stops, even if further triggers could also fire.
Attached is an example pig.json
with a workaround to get the desired behavior:
There's just one trigger on the damage sensor:
And that new event is defined this way, where it fires the event on the pig and another event on the player:
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki