Setting the location.dimension field of the entity condition in player_killed_entity will not make the advancement check for the entity's dimension, but the dimension the player that will get the advancement is in.
How to reproduce:
Summon a ghast with no AI in the nether.
Use
/forceload add
on the chunk the ghast is in, or have another player stand close to the ghast to make sure it is loaded.Place a TNT block next to it.
Light the TNT using flint and steel or a fire charge and go through a nether portal before it explodes.
→ ❌ You just got the advancement "Uneasy Alliance", even though the ghast was in the nether.
Expected result:
The advancement would require the ghast to be in the overworld.
Observed result:
Only the player is required to be in the overworld.
Code analysis:
Code analysis by @unknown can be found in this comment.
The issue is that the
LocationPredicate#matches
method only receives(serverLevel, x, y, z)
. It uses the serverLevel to check the dimension. WhenKilledTrigger#trigger
tests theEntityPredicate
, it always uses the player's server level from theLootContext
, instead of the level of the entity. This probably affects all entity predicates.