Mojira Archive
MC-272893

Advancements: `components` requires exact match with target rather then specific tag

the following advancement should trigger when a player picks up a bucket of tropical fish with the `BucketVariantTag` set to `67502593`:

 

{
  "display": {
    "icon": {
      "id": "minecraft:warped_fungus",
      "count": 1
    },
    "title": {
      "text": "triggered"
    },
    "description": {
      "translate": "advancements.husbandry.tactical_fishing.description"
    }
  },
  "parent": "minecraft:husbandry/fishy_business",
  "criteria": {
    "tropical_fish_bucket": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "items": "minecraft:tropical_fish_bucket",
            "components": {
              "minecraft:bucket_entity_data": {
                "BucketVariantTag":67502593
              }
            }
          }
        ]
      }
    }
  },
  "requirements": [
    [
      "tropical_fish_bucket"
    ]
  ],
  "sends_telemetry_event": false
}

However it doesn't work because the components needs an exact match as most naturally caught tropical fish would have a health tag, an exact match can be created with 

/give @s minecraft:tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67502593}]

This is because the components need to match exactly, the current system doesn't allow for selective tag matching, previous verions would allow for specific tag matching with 

"trigger": "minecraft:inventory_changed",
"conditions": {
    "items": [
        {
            "items": [
                "minecraft:tropical_fish_bucket"
            ],
            "nbt": "{BucketVariantTag: 67502593}"
        }
    ]
}

this is now missing functionality caused form the component system

 

How to reproduce:

  1. Add datapack-BucketVariantTag.tag to a world
  2. Spawn a tropical fish with `BucketVariantTag` set to 67502593
  3. Catch the fish in a water bucket and that should trigger the advancement but it won't
  4. if you use the following command it will give you a tropical fish bucket where the "minecraft:bucket_entity_data" component is composed solely of the BucketVariantTag
    /give @s minecraft:tropical_fish_bucket[minecraft:bucket_entity_data={BucketVariantTag:67502593}]
  1. if you now place that fish in water
  2. clear you advancements
  3. pick the fish in a bucket it will no longer trigger the advancement as it now ill hvae a health tag inside the "minecraft:bucket_entity_data" tag

 

Expected result:

  1. the advancement should trigger when a fish with the "BucketVariantTag" of 67502593 is caught

Actual result:

  1. the advancements do not trigger unless the "BucketVariantTag" is the only tag in "minecraft:bucket_entity_data"

I've included the datapack for testing

Works As Intended

zer0p1us

2024-06-02, 05:53 PM

2024-08-31, 06:31 PM

2024-06-14, 07:19 AM

0

3

Community Consensus

Advancements

Advancements, components

1.20.6 - 1.211.20.6, 1.21 Pre-Release 2, 1.21 Pre-Release 4, 1.21 Release Candidate 1, 1.21

-