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

"Item" field is still considered valid by predicates, but is not used when testing for the predicate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 1.17 Pre-release 1
    • Windows 10
    • Confirmed
    • Data Packs
    • Important

      As of 1.17 pre-release 1, predicates testing for an entity's equipment (such as the one below) will always return "test passed," regardless of whether or not the entity has the item equipped, unless another field - including, but not limited to, "count" or "durability" - is specified. (Or if the new "items" field is used instead, but I have yet to get that to work with item tags, and so hesitate to call it a viable workaround).

      Update: This is actually a bit more in-depth than I thought it was, and I suspect this is may be a slightly different manifestation of a pre-existing bug. Nonetheless, I leave the previous description in the hopes that it might clarify things for those that reached the same conclusion I did. Chalk this up to lack of documentation.

      Despite the "item" field of predicates being phased out in favor of the "items:[]" array, predicates will still accept "item" as valid input (i.e. the predicate still loads, rather than returning an error that the predicate contains an invalid field), but the field itself does not actually do anything.

      For example, this predicate:

      { "condition": "minecraft:entity_properties", "entity": "this", "predicate": {"equipment": {"head": {"item": "minecraft:iron_helmet"} }}}

      always returns true, whether or not the entity tested is wearing an iron helmet, and regardless of the fact that the "item" field does not actually do anything. The new syntax should be:

       

      { "condition": "minecraft:entity_properties", "entity": "this", "predicate": {"equipment": {"head": {"items": ["minecraft:iron_helmet"]} }}}

      Long story short, one would expect that either A) the predicate would return an error once it hit the invalid "item" field, or B) the "item" field would still function as it did prior to 1.17 pre-release 1.

       

       

        1. 2021-05-28_09.34.30.png
          1.70 MB
          Kirven Avion
        2. 2021-05-28_09.34.39.png
          1.70 MB
          Kirven Avion

            boq [Mojang] Bartosz Bok
            KirbAvion Kirven Avion
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: