The bug
Vaults are not unlocked by using a key item with a non-default max stack size.
To reproduce
Execute the following commands:
/setblock ~1 ~ ~ vault{config: {key_item:{count: 1, id:"minecraft:dirt"}}} /give @p dirt 2
Use the dirt block on the vault and notice how it is unlocked.
Repeat the first command.
/give @p dirt[minecraft:max_stack_size=2] 2
Try unlocking the vault using the given dirt.
Observed result
The vault is not unlocked.
Upon further investigation, this seems to affect every item that has non-default component data (e.g.
custom_data
). It seems to check for exact matches of the key item data; for example, the provided command does not work, but the following does:This is a bit strict (could probably be just an id check?), but it's very likely intended.
Edit: this is a duplicate of MC-268183, though that ticket hasn't yet been updated to use components instead of tags.