Code safe

A code safe is a lockable block that stores items.

Breaking
A code safe can be broken only using a pickaxe of harvest level 2 (iron) or higher. If the safe is unlocked when broken, it drops its contents, however, if the safe is locked, the items are saved to the item's NBT (just like vanilla Shulker Box does).

Natural generation
Code safes generate in certain structures, like hotels and police stations.

Usage
Code safes can be used to securily store items and can also be used as a sort of an backpack.

To place a chest, use the Place Block control on the face of a block adjacent to the space the chest should occupy. Unlike vanilla chests the code safe can face all 6 directions, including up and down.

Upon activating a locked safe, a "keypad" GUI, with 6 buttons appears. These 6 buttons are used to change white numbers between them, that represent the currently selected combination.

When the correct combination is elected, the block's model changes and a sound effect is played. If it is the first safe the player has opened, the "Locksmith" advancement is granted. The player must close the "keypad" GUI on their own.

Upon activating an unlocked safe, a "normal" container GUI with 3x3 slots grid appears. Unlocked safe can be accessed by hoppers.

"Shift clicking" on an unlocked safe open once again the "keypad" GUI, that can be used to lock the safe.

The player can set their own combination, by renaming the item to the combination using anvil.

The correct combination can be either guessed or obtained using the Stethoscope item. Shift clicking the block with the item in hand tells you, whether a random number is smaller, equal to or larger than the correct number of a random digit. Keep in mind the digits are counted from right to left - digit 0 is ones, 1 is tens, 2 is hundreds.