mojira.dev
MC-251617

Advancement trigger player_killed_entity checking for an entity's dimension always checks for the player's dimension instead

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:

  1. Summon a ghast with no AI in the nether.

  2. 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.

  3. Place a TNT block next to it.

  4. 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.

Linked issues

Comments 1

The issue is that the LocationPredicate#matches method only receives (serverLevel, x, y, z). It uses the serverLevel to check the dimension. When KilledTrigger#trigger tests the EntityPredicate, it always uses the player's server level from the LootContext, instead of the level of the entity. This probably affects all entity predicates.

[Mod] ManosSef

(Unassigned)

Confirmed

Platform

Normal

Advancements

1.18.2, 22w18a, 22w19a, 1.19 Pre-release 2, 1.19, ..., 24w39a, 1.21.3, 1.21.4, 1.21.5, 1.21.6

Retrieved