If a player is hurt by something that isn't an entity, the next time the player triggers the entity_hurt_player advancement, it has the wrong damage type context. This causes a simple hit by a zombie after being on fire to get true as result for the damage condition
minecraft:is_fire.
Steps to Reproduce:
Create an advancement with the following content
{ "criteria": { "target": { "trigger": "minecraft:entity_hurt_player", "conditions": { "damage": { "source_entity": { "type": "minecraft:zombie" } } } }, "fire": { "trigger": "minecraft:entity_hurt_player", "conditions": { "damage": { "type": { "tags": [ { "id": "minecraft:is_fire", "expected": true } ] } } } }, "!fire": { "trigger": "minecraft:entity_hurt_player", "conditions": { "damage": { "type": { "tags": [ { "id": "minecraft:is_fire", "expected": false } ] } } } } }, "requirements": [ [ "target" ], [ "fire", "!fire" ] ], "rewards": { "function": "namespace:on_hurt" } }
Create the reward function referenced by the advancement with the following content:
execute if entity @s[advancements={namespace:on_hurt={fire=true}}] run say Damage Type Fire advancement revoke @s only namespace:on_hurt
Load the datapack in a minecraft world.
Cause your player damage in one of these ways:
Set yourself on fire and wait for the fire to go away
Simply use the command: /damage @s 1 minecraft:in_fire
Summon a zombie
Let the zombie hit you
You will see the message "Damage Type Fire" in the chat
Let the zombie hit you again
Now the message won't show (until being hurt by fire again)
Observed Results:
The hit by the zombie sets the fire criteria to true
Expected Results:
The hit by the zombie sets the fire criteria to false
Notes:
This problem is not only present for being hurt by fire. I see the same problem when checking for the damage type minecraft:magic. In this case if for example the poison effect is active on a player, the hit of a zombie is also processed as a damage type minecraft:magic.
The problem seems to be with any type of hit that is not caused by a source entity.
I have also tested with a player_hurt_entity advancement, I don't see the same issue here.
Comments 4
I thought it's invalid, once the criterion is completed, it wouldn't be reverted until you manually revoke it or the advancement it belonged.
Could you please attach a minimal setup data pack to reproduce the issue?