mojira.dev
MC-181630

Advancement trigger "minecraft:tick" does not support standard "player" predicate

The bug

As of 20w18a, all advancement triggers (with the intended exception of impossible) have access to a player predicate to check the player that activated the trigger. An example:

{
    "criteria": {
        "test": {
            "trigger": "minecraft:location",
            "conditions": {
                "player": [
                    {
                        "condition": "minecraft:entity_properties",
                        "entity": "this",
                        "predicate": {
                            "flags": {
                                "is_sprinting": true
                            }
                        }
                    }
                ]
            }
        }
    }
}

However, the predicate does not work in the minecraft:tick trigger.

{
    "criteria": {
        "test": {
            "trigger": "minecraft:tick",
            "conditions": {
                "player": [
                    {
                        "condition": "minecraft:entity_properties",
                        "entity": "this",
                        "predicate": {
                            "flags": {
                                "is_sprinting": true
                            }
                        }
                    }
                ]
            }
        }
    }
}

Code analysis

Using Mojang's mappings for 20w18a:

There are two trigger methods in net.minecraft.advancements.critereon.SimpleCriterionTrigger: one that takes in a predicate (which, to be clear, is a consolidation of the trigger's conditions, not player) and one that does not. The first method checks the player predicate but the second does not.

minecraft:tick uses the second method, preventing the use of player.

Comments 9

Confirmed, it's happened to me and a few others as well

Confirmed in 20w19a.

Confirmed in 20w20a.

Confirmed in 20w20b.

Confirmed in 20w21a.

The enter_block advancement trigger can be used as a workaround if you want to check only once:

{
    "criteria": {
        "enter_block": {
            "trigger": "enter_block",
            "conditions": {
                "player": [
                    {
                        "condition": "entity_properties",
                        "entity": "this",
                        "predicate": {
                            "flags": {
                                "is_sprinting": true
                            }
                        }
                    }
                ]
            }
        }
    }
}

Regardless, the bug still needs to be fixed for the trigger to be intuitive to other players.

Confirmed in 20w22a.

Confirmed in 1.16 Pre-release 1.

Confirmed in 1.16 Pre-release 2.

Skylinerw

boq

Plausible

Low

Advancements

20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 20w22a, 1.16 Pre-release 2

1.16 Pre-release 3

Retrieved