mojira.dev
MC-137427

Advancements treat the player as the "direct_entity" source of primed TNT damage

When a player damages or kills an entity by igniting TNT, advancements should get a minecraft:player_hurt_entity and/or minecraft:player_killed_entity trigger, with the "direct_entity" set to the primed TNT in question and the "source_entity" set to the player that lit it.

Instead, the "direct_entity" is always set to the player. Every other way the player has of damaging targets at a distance while giving the player credit (arrows, tridents, snowballs, eggs, splash/lingering potions of harming) sets the "direct_entity" to the correct target.

To test this:

  • Add the attached data pack to a world. It prints a message when the player hurts or kills an entity, and an additional message if the "direct_entity" is the player or a primed TNT.

  • Hurt/kill an entity with your fist, and note that the "direct_entity" is correctly set to the player.

  • Hurt/kill an entity with a non-TNT projectile, and note that, since we receive no second message, the "direct_entity" is correctly not set to the player (nor, for some reason, to a primed TNT).

  • Hurt/kill an entity by lighting TNT with a flint and steel, and note that the "direct_entity" is incorrectly set to the player.

Attachments

Comments 3

The same problem exists when you punch an end_crystal. Interestingly, if you shoot an end_crystal, the direct_entity isn't anything at all. MC-165111

Confirmed for 1.16.4

Confirmed for 1.16.5 and 21w15a.

AjaxGb

(Unassigned)

Confirmed

Advancements

damage, data-pack, tnt

Minecraft 1.13.2, 1.15.2, 20w08a, 1.16.4, 1.16.5, 21w15a

Retrieved