mojira.dev
MC-117419

Advancement conditions with nbt data do not work correctly for inventory_changed

I have created a file at <world_save>/data/advancements/zed/challenges/root.json with the following contents:

{
    "display": {
        "icon": {
            "item": "minecraft:redstone_block"
        },
        "title": "Zedcraft",
        "background": "minecraft:textures/gui/advancements/backgrounds/nether.png",
        "description": "Custom goals and challenges for Zedcraft"
    },
    "criteria": {
        "create_zedcraft_advancement_book": {
            "trigger": "minecraft:inventory_changed",
            "conditions": {
                "items": [
                    {
                        "item": "minecraft:book",
                        "nbt": "{display:{Name:\"Zedcraft challenges\"}}"
                    }
                ]
            }
        }
    }
}

I am unable to get the advancement to trigger using either a Book named Zedcraft challenges in an anvil or by using the following give command:

/give @s minecraft:book 1 0 {display:{Name:"Zedcraft challenges"}}

However if I remove the NBT condition it works correctly for any book, and I know that Minecraft is recognising the NBT string as if I make the syntax invalid in the JSON file, I get an exception in the logs. I tried it with written_ book as well with a 'title' condition as well as with various different title/name strings. This could be true for other NBT related conditions/triggers as well, but I have only tested it on inventory_changed.

Comments 2

Seems to be the case indeed... Unless maybe we're doing it wrongly.

It looks like it has to include the tag tag.

{tag:{display:{Name:\"Zedcraft challenges\"}}}

But this looks like unintended behavior anyways since count and damage which are in this root tag as well can be tested seperately.

DrHenchman

Nathan Adams

Confirmed

advancement, nbt, trigger

Minecraft 1.12 Pre-Release 2

Minecraft 1.12 Pre-Release 3

Retrieved