mojira.dev
MC-268183

Vaults item_key checks for all components instead of only defined components

While playing around with Vaults and Trial Keys, I discovered an inconsistency about NBT checks.

Vaults' item_key tag checks if all NBT tags match, instead of just the defined ones in the tag.

I explain myself:

  1. Setblock a vault with 

    {config:{key_item:{id:"minecraft:trial_key",Count:1,tag:{Tags:["test"]}}}}
  2. Give yourself a trial key with 

    {Tags:["test"],display:{Name:'{"text":"Super key!"}'}}
    • It won't work, as the vault checks for all NBT

  3. Now, give yourself a key with just 

    {Tags:["test"]}
    • It will work, because the whole NBT match

That's an issue if a player renames their key item, because it will no longer match the vault's key item.

Linked issues

Comments 5

I feel like this is intentional, as you can define in vault NBT what the key_item is, which includes item components. Therefore, you could also modify the vault NBT to make it only accept certain Trial Keys for mapmakers (then again, this is marked as a bug, so...)

I do feel like this should be fixed for named items, though. Maybe only check the "minecraft:custom_data" component?

Can confirm in 1.21

You can replicate this just in survival by simply renaming a Trial Key in an anvil - that trial key becomes unable to unlock any vault in trial chambers anywhere

Can confirm up to the most current snapshot 24w40a

Can Confirm in 25w02a

Yanis48

(Unassigned)

1225151

Confirmed

Expansion B

Normal

Commands, Items

command, item

24w05a, 24w05b, 24w06a, 24w07a, 24w09a, ..., 1.21, 24w40a, 1.21.3, 1.21.4, 25w03a

Retrieved