mojira.dev
MC-274636

Enchantment predicates are now specific

With the new item component system, a functionality has been removed/replaced. We can't have an advancement that would trigger if the player is wearing an equipment with a specific enchantment, as now the comparison is of type "is exactly" instead of "contains".

 

Steps to repro:

  • have a datapack adding an advancement such as the one attached

  • go in the nether with a chestplate enchanted with the binding curse and any other enchant

Expected behavior (as before):

The advancement is triggered.

Observed behavior:

The advancement is not triggered. It can be triggered only if the chestplate has only the binding curse enchantment.

 

Although I understand this behavior could be useful, I believe the previous one is more interesting. At least being able to choose the way the predicate is being tested would be nice.

Attachments

Comments 3

Have you tried it with the minecraft:enchantments item sub-predicate instead? The wiki has the current format.

Although I understand this behavior could be useful, I believe the previous one is more interesting. At least being able to choose the way the predicate is being tested would be nice.

There already is a way to do that. You need to make the following change to your advancement:

"components": {
                    "minecraft:enchantments": {
                      "levels": {
                        "minecraft:binding_curse": 1
                      }
                    }
                  }

This needs to be changed to the following:

"predicates": {
                    "minecraft:enchantments": [
                      {
                        "enchantments": "minecraft:binding_curse",
                        "levels": 1
                      }
                    ]
                  }

Oh indeed my bad! Didn't find this predicate, thought they were replaced with components! Thanks a lot.

(It's marked as resolved, but I don't know how to close it)

Pardys_

(Unassigned)

Unconfirmed

(Unassigned)

enchantments, item-component, predicate

1.21

Retrieved