Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-181630

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

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 20w18a, 20w19a, 20w20a, 20w20b, 20w21a, 20w22a, 1.16 Pre-release 2
    • 1.16 Pre-release 3
    • None
    • Plausible
    • Advancements
    • Low

    Description

      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.

      Attachments

        Activity

          People

            boq [Mojang] Bartosz Bok
            skylinerw [Mod] Skylinerw
            Votes:
            12 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              CHK: