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:
Setblock a vault with
{config:{key_item:{id:"minecraft:trial_key",Count:1,tag:{Tags:["test"]}}}}
Give yourself a trial key with
{Tags:["test"],display:{Name:'{"text":"Super key!"}'}}
It won't work, as the vault checks for all NBT
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
is duplicated by 3
Comments 5
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
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?