REDSTONEPEDIA › Circuits › Combination locks
Combination lock: item frames as dials, opens only at the code
3 dials · 73 blocks
Its output turns on only while each of its 3 dials (item frames, 8 positions each) is turned to the same position as its code frame, on the other side of the machine; set the code by turning the code frames, and keep that side out of sight.
made of comparator, redstone torch, redstone wire · fits in 5×3×10
4 versions, 1 to 4
Every number of dials 4
The best design for each number of dials: pick one to see it.
Try it
Tap a dial's tag in the view (DIAL 1 to DIAL 3) or the frame itself to turn it one step, 8 steps around; the CODE 1 to CODE 3 tags set the code the same way (on a wide screen, the Dial and Code buttons under the view do it too). The output turns on (open) only while every dial shows the same position as its code frame. In the game, right-click a frame to turn it. To open a door with it, run redstone dust from its output (where the view shows the lamp) to the door.
How this design does it: The 3 dials hang on the front (west) face; the code frames hang on the back (east) face, facing away, so a player at the dials sees only the dials and the output, never the code.
Build it
Download .litematic Download the design as text
The .litematic opens in Litematica (Minecraft 26.3): every block of the design in one region. The text file is the same build written as plain text, block by block.
Its 6 item frames must each hold an item (arrows in the download; any item works): building it by hand, put one in each frame. A right-click turns a frame's item one step of 8.
Blocks used: comparator item frame redstone torch redstone wire stone
Details: how it works, measurements and properties
In depth
turns its output on only while every item-frame dial shows the same position as its own code frame; set the code by turning the code frames
How to try it
The dials are the item frames tagged DIAL 1 to DIAL 3, the code frames those tagged CODE 1 to CODE 3: tap a tag, or its button under the view, to turn that frame one step (8 steps around). The output, tagged OUT, turns on only while every dial shows the same position as its code frame. Drag to look around, pinch or scroll to zoom.
Inputs and output over time
The inputs follow this schedule (the 3D view's demo plays the same). Lime: an input is on; orange: the output is on (taller = a stronger signal, 1 to 15). Time runs left to right in game ticks (20 ticks = 1 s).
Swipe the diagram sideways: the whole sequence lasts 41117 ticks (34 min 15.85 s).
Step by step (4 lines)
dials 351 code 351 open after 6 ticks (0.3 s) dials 451 code 351 shut after 8 ticks (0.4 s) dials 604 code 604 open after 6 ticks (0.3 s) dials 714 code 604 shut after 8 ticks (0.4 s)
Measurements
| metric | value | what it means |
|---|---|---|
| dials | 3 | |
| combinations | tried 1,024 (512 per code, 2 codes) | |
| opens within | 6 ticks (0.3 s) | |
| closes within | 8 ticks (0.4 s) |
Notes from its designer
Put any item in each of the 6 item frames; a frame turns through 8 positions, one right-click each. The 3 dials hang on the front (west) face; the code frames hang on the back (east) face, facing away, so a player at the dials sees only the dials and the output, never the code. Set the code from behind by turning the code frames, then turn the dials to match them: the torch at the north end, under the bus, lights (open) only when every dial shows the same position as its code frame, and never for a moment while you turn. Wire a piston door or an iron door to that torch. Inside, per dial: a comparator behind the code frame's block reads the code and powers a block beside the code dust, so the dust carries the code at full value; the dial's comparator passes the dial's value only if it is at least the code (else a torch under its dust lights), and a second comparator passes the code only if it is at least the dial's value (else a torch on its block lights). One dust line under all the torches joins every mismatch into the block under its north end, which turns the output torch off (opens within 6 ticks, closes within 8). A dial takes 3 rows; dials pair up back to back, with one empty row between pairs.
Properties
| Study | Combination locks |
|---|---|
| Kind | Combination lock: item frames as dials, opens only at the code |
| Blocks placed | 73 (not counting the input levers or buttons the view adds) |
| Box | 5×3×10 (150 blocks of space) |
| Made of (the blocks that change state) | comparator, redstone torch, redstone wire |
| Inputs / outputs | D0 (item frame), D1 (item frame), D2 (item frame), K0 (item frame), K1 (item frame), K2 (item frame) / OUT |
| Flags | several versions of one mechanism |
| Design file | lock3-hid |
The design file
Design file (58 lines)
# Combination lock: 3 dials · 73 blocks
# https://vjeux.github.io/redstonepedia/circuits/lock/lock3-hid.html
name: lock3-hid
circuit: lock 3
port input.d0: -3 2 0 frame
port input.k0: 2 2 2 frame
port input.d1: -3 2 5 frame
port input.k1: 2 2 3 frame
port input.d2: -3 2 7 frame
port input.k2: 2 2 9 frame
port output: 1 0 0
entity: minecraft:item_frame -2.5 2.5 0.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 2.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:3b}
entity: minecraft:item_frame -2.5 2.5 5.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 3.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:5b}
entity: minecraft:item_frame -2.5 2.5 7.5 {Facing:4b,Item:{id:"minecraft:arrow",count:1},ItemRotation:0b}
entity: minecraft:item_frame 2.5 2.5 9.5 {Facing:5b,Item:{id:"minecraft:arrow",count:1},ItemRotation:1b}
origin: -3 0 0
palette:
S minecraft:stone
w minecraft:redstone_wire
T minecraft:comparator[facing=west,mode=compare,powered=false]
K minecraft:comparator[facing=east,mode=compare,powered=false]
A minecraft:redstone_wall_torch[facing=east,lit=true]
O minecraft:redstone_wall_torch[facing=west,lit=true]
layer 0:
....OS
.....S
.....S
.....S
.....S
.....S
.....S
.....S
.....S
.
layer 1:
..SSAw
..SS.w
...S.w
...S.w
..SS.w
..SSAw
.....w
..SSAw
..SS.w
...S
layer 2:
.STw
..wTSA
..SKS
..SKS
..wTSA
.STw
.
.STw
..wTSA
..SKS