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

To grant an advancement, can't check a specific data only in "minecraft:custom_data"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Windows 11, Java 21.0.3
    • Unconfirmed
    • (Unassigned)

      What I want to do:

      I want to grant an advancement if the user have an item with a specific custom data in Item.components."minecraft:custom_data", for example aCustomData, regardless of others custom data in the item.

      An example:

      If I have an enchanted book with the following content ...

      give @s minecraft:enchanted_book[custom_data={aCustomData:1b,anotherCustomData:1b,aLastCustomData:1b}]

      ... I expect the following advancement to be granted:

      {
          ...
          "criteria": {
              "aCustomData": {
                  "trigger": "minecraft:inventory_changed",
                  "conditions": {
                      "items": [
                          {
                              "components": {
                                  "minecraft:custom_data": {
                                      "aCustomData": 1
                                  }
                              }
                          }
                      ]
                  }
              }
          }
      }

      What happen:

      Nothing happen, the advancement is not granted. Maybe because the given item have extra elements in "minecraft:custom_data" (i.e. anotherCustomData:1b,aLastCustomData:1b).

      It seems it check if all the content inside "minecraft:custom_data" of the item is the same than the one described in the advancement, instead of checking only the custom data described in "minecraft:custom_data" of the advancement.

      If I instead give myself this item:

      give @s minecraft:enchanted_book[custom_data={aCustomData:1b}] 

      Then the advancement described above is granted.

      What I expected:

      The advancement should be granted if the specified custom data in the advancement match the value of the same custom data in the item, regardless of other custom datas in this item (that are not specified/required by the advancement).

            Unassigned Unassigned
            Ξии Enzo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: