
Video: Minecraft Simple Combination Lock (Bedrock/Java) by CraftyMasterman
How to build it
- Build the 3x3 Button Panel
Construct a 3x3 wall of solid blocks and place 9 buttons on the front face. Behind the top row of buttons, place 3 redstone dust directly on top of the blocks.
- Wire the Middle and Bottom Button Rows
Behind the middle row of buttons, place a line of blocks with redstone dust and comparators to read the middle inputs at differing distances. Under the bottom row of buttons, run 3 pieces of redstone dust into a comparator leading into a solid block.
- Add the Keypad Signal Calibrator
Merge the three rows into a single redstone dust line so each button produces a unique signal strength (from 7 to 15). Run this line into the back of a comparator set to subtract mode, and point a second comparator into its side reading a chest filled with 8 non-stackable items (such as wooden shovels).
- Start the First Digit Module
From the output of the keypad's subtract comparator, place a solid block, then run a chain of two comparators forward into another solid block. Place a redstone torch on the side of this front block and run two repeaters out from the torch to form the locking line.
- Build the Digit Decoder Unit
Branching sideways out of the solid block before the two comparators, place a comparator in subtract mode. Point another comparator into its side reading an empty chest (your 4th digit chest), then run 2 redstone dust out of the subtract comparator into parallel repeaters and a side comparator.
- Place the Locking Repeater Chain
At the end of the first digit module, place a 2-tick repeater facing forward so that the repeater line coming from the redstone torch points directly into its side to lock it. Behind that 2-tick repeater, place a comparator in subtract mode.
- Tile Modules for Digits 2 and 3
Repeat the module pattern behind the first one for your middle digits: place dust, two forward comparators, a block with a side torch, two locking repeaters, and the side chest-comparison circuit. On the output side of each new module, follow the pattern of a 1-tick repeater, a 4-tick repeater, a subtract comparator, and a locked 2-tick repeater.
- Build the Final Digit and Start Circuit
For the furthest module back (which checks the very first digit of your code), omit the side torch and instead build the trigger circuit 6 blocks behind the last torch block. Place a subtract comparator paired with a side comparator and chest (your 1st digit chest), leading into 2 dust, 3 repeaters, and a solid block with a redstone torch on its side.
- Add the Hopper Latch
Next to the trigger circuit's redstone torch, place two hoppers facing into each other with 1 random item inside. Have a comparator read the hopper farthest from the torch to feed the initial pulse into the locked repeater chain.
- Program Your Passcode in the Chests
Set each digit (1 to 9) by placing items into the module chests starting from the back chest (1st digit) to the front chest (last digit). For digit 1, put 1 stackable item inside; for digit 2, put 2 non-stackable items; for each higher number up to 9, add 2 more non-stackable items (e.g., 4 shovels for 3, 6 shovels for 4).
- Attach the Dropper T Flip-Flop Output
At the front end of the locked repeater chain, build a T flip-flop by placing a dropper facing up into a dropper facing sideways, leading into a hopper pointing down into the bottom dropper. Put 1 item inside the droppers, read the top dropper with a comparator into a repeater for your door output, and wire a reset button to the top dropper using a repeater to close the lock.
How it works
This circuit operates by converting button presses into exact analog signal strengths and stepping a signal forward through a locked shift register:
- Signal Encoding: Because each of the 9 buttons is wired a different distance from the output line, pressing a button produces a signal strength between 7 and 15. The chest with 8 non-stackable items outputs signal strength 6 into the side of the first subtract comparator, reducing the keypad output to a clean 1 through 9 matching the button pressed.
- Comparator Equality Check: As the signal travels down the main comparator backbone, each module compares the incoming signal strength with the strength stored in its code chest. If the button pressed is weaker than the target digit, the subtract comparator outputs nothing; if it is stronger, the extra signal travels through a side comparator and subtracts from the output, canceling it out. Only an exact match allows a signal to pulse the module.
- Sequential Ripple & Auto-Reset: The back module checks the 1st digit and releases a pulse from the hopper latch into the chain of locked 2-tick repeaters. Each subsequent correct digit unlocks its module's 2-tick repeater for a brief moment, allowing the stored signal to step forward one module. Pressing any wrong button unlocks the wrong stage or fails to hold the signal, causing the pulse to die out and automatically resetting the lock.
Tips & variations
- infinitely Expandable: Each digit module is 2 blocks long. You can add as many digits to your password as you want by tiling more pink digit modules before building the back blue starter circuit. Always leave 6 blocks of space between the last redstone torch block and the back starter circuit.
- Avoid Quasi-Connectivity on Java: When wiring the reset line into the top dropper of the T flip-flop, do not run redstone dust over a solid block next to the dropper on Java Edition, or it can BUD-power the dropper. Run a repeater directly into the dust or use transparent blocks/slabs.
- Item Frame or Lectern Input Variant: You can replace the entire 9-button panel and the first 8-shovel subtractor chest with an item frame or lectern. Place a comparator behind the item frame/lectern running into a block, and use a sticky piston pushing a block down over the line (controlled by a confirmation button and inverting torch) to send the signal only when the button is pressed. Because item frames already start at signal strength 1, subtract 1 signal strength from every code chest (Digit 1 = empty chest, Digit 2 = 1 stackable item, Digit 3 = 2 non-stackable items, etc.).





