Self-Solving 2x2 Rubik's Cube

Build an oversized glowing 2x2 Rubik's Cube that hovers above a dark prismarine pedestal and smoothly rotates its faces by itself using display entities.

Java EditionComplex Contraptions & CinematicsExpert25 commandsTested on a real 26.2 & 26.3 server
A glowing 2x2 multicolored block cube floats and animates above a dark prismarine and sea lantern pedestal. Download the GIF Video & GIF © www.9minecraft.net

SimulationsTechnologyRainbowCyanDecorationLearningServer LobbyBlock displaysSmooth animation (interpolation)Block building (fill/setblock/clone)Sounds21+ commands

Above a glowing dark prismarine and sea lantern pedestal floats an oversized 2x2 Rubik's Cube built from eight colorful glowing block display entities. All eight cubies share a single central pivot point at the heart of the puzzle and use translation offsets to lock together into a solid, cohesive 3x3-block cube.

Using smooth transformation interpolation and exact quaternion rotation keyframes, the upper layer, front layer, and entire cube twist through crisp 90-degree turns automatically without ever drifting out of alignment, surrounded by glowing dust and enchantment particles.

1. Setup - type these once 11 commands

  1. /scoreboard objectives add c9_t dummy
  2. /fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 dark_prismarine
  3. /setblock ~ ~ ~ sea_lantern
  4. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c1"],Glowing:1b,glow_color_override:16720418,transformation:{translation:[-1.45f,-1.45f,-1.45f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:red_concrete"}}
  5. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c2"],Glowing:1b,glow_color_override:16750848,transformation:{translation:[0.05f,-1.45f,-1.45f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:orange_concrete"}}
  6. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c3"],Glowing:1b,glow_color_override:16770560,transformation:{translation:[-1.45f,-1.45f,0.05f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:yellow_concrete"}}
  7. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c4"],Glowing:1b,glow_color_override:5635925,transformation:{translation:[0.05f,-1.45f,0.05f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:lime_concrete"}}
  8. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c5"],Glowing:1b,glow_color_override:5636095,transformation:{translation:[-1.45f,0.05f,-1.45f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:cyan_concrete"}}
  9. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c6"],Glowing:1b,glow_color_override:3368703,transformation:{translation:[0.05f,0.05f,-1.45f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:blue_concrete"}}
  10. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c7"],Glowing:1b,glow_color_override:16733695,transformation:{translation:[-1.45f,0.05f,0.05f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:magenta_concrete"}}
  11. /summon block_display ~ ~3.5 ~ {Tags:["c9_c","c9_c8"],Glowing:1b,glow_color_override:16777215,transformation:{translation:[0.05f,0.05f,0.05f],scale:[1.4f,1.4f,1.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]},block_state:{Name:"minecraft:white_concrete"}}

2. Loop - one repeating command block each (Always Active) 14 commands

  1. /scoreboard players add #t c9_t 1
  2. /execute if score #t c9_t matches 100.. run scoreboard players set #t c9_t 0
  3. /execute if score #t c9_t matches 5 as @e[tag=c9_c] if entity @s[tag=!c9_c1,tag=!c9_c2,tag=!c9_c3,tag=!c9_c4] run data merge entity @s {start_interpolation:0,interpolation_duration:16,transformation:{left_rotation:[0f,0.7071f,0f,0.7071f]}}
  4. /execute if score #t c9_t matches 30 as @e[tag=c9_c] if entity @s[tag=!c9_c1,tag=!c9_c2,tag=!c9_c6,tag=!c9_c8] run data merge entity @s {start_interpolation:0,interpolation_duration:16,transformation:{right_rotation:[0f,0f,0.7071f,0.7071f]}}
  5. /execute if score #t c9_t matches 55 as @e[tag=c9_c] if entity @s[tag=!c9_c1,tag=!c9_c2,tag=!c9_c6,tag=!c9_c8] run data merge entity @s {start_interpolation:0,interpolation_duration:16,transformation:{right_rotation:[0f,0f,0f,1f]}}
  6. /execute if score #t c9_t matches 80 as @e[tag=c9_c] run data merge entity @s {start_interpolation:0,interpolation_duration:16,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
  7. /execute if score #t c9_t matches 5 run playsound block.piston.extend master @a ~ ~3.5 ~ 0.7 1.4
  8. /execute if score #t c9_t matches 30 run playsound block.piston.contract master @a ~ ~3.5 ~ 0.7 1.5
  9. /execute if score #t c9_t matches 55 run playsound block.piston.extend master @a ~ ~3.5 ~ 0.7 1.6
  10. /execute if score #t c9_t matches 80 run playsound block.beacon.activate master @a ~ ~3.5 ~ 0.8 1.8
  11. /execute if score #t c9_t matches 21 run particle end_rod ~ ~4.2 ~ 1.1 0.2 1.1 0.04 16
  12. /execute if score #t c9_t matches 46 run particle end_rod ~ ~3.5 ~1.1 0.9 0.9 0.2 0.04 16
  13. /execute if score #t c9_t matches 96 run particle totem_of_undying ~ ~3.5 ~ 1.2 1.2 1.2 0.15 25
  14. /particle dust{color:[0.2,0.95,1.0],scale:1.3} ~ ~2.0 ~ 1.1 0.2 1.1 0 2

How it works

Frames from the test run

Self-Solving 2x2 Rubik's Cube - frame 1Self-Solving 2x2 Rubik's Cube - frame 2Self-Solving 2x2 Rubik's Cube - frame 3

Recorded on our own test server: 59 frames at about 9.8 fps. Our image check saw: A 2x2 cube of glowing colored blocks floats above a dark prismarine and sea lantern pedestal, though the cubies are single-colored blocks and translate disjointedly rather than rotating like a solved Rubik's cube.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Stand at the center of an open flat area and run each command in the Setup list once in chat (or place them in impulse command blocks) to create the scoreboard, pedestal, and eight glowing cubies.
  2. Place one repeating command block set to Always Active at the exact same stage center (~ ~ ~), followed by 13 chain command blocks set to Always Active and Unconditional.
  3. Paste the 14 Loop commands in order into the repeating and chain command blocks.
  4. Watch the oversized 2x2 Rubik's Cube hover above the sea lantern pedestal and automatically twist and solve its faces every 5 seconds.
  5. To remove the build when you are done, disable the repeating command block and run the Remove commands.

Remove it again 4 commands

  1. /kill @e[tag=c9_c]
  2. /scoreboard objectives remove c9_t
  3. /fill ~-2 ~-1 ~-2 ~2 ~ ~2 air
  4. /fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 grass_block

FAQ

Why do the cubies never drift apart after many rotations?

Instead of using relative teleport steps that accumulate rounding errors, all eight block displays stay anchored at the exact same center point (~ ~3.5 ~) and rotate around that pivot using exact quaternion keyframes in their transformation data.

Can I change the speed of the face turns?

Yes. Increase or decrease the interpolation_duration value (currently 16 ticks) inside the data merge commands in the loop to make each 90-degree twist slower or faster.

Commands used

/data/execute/fill/particle/playsound/scoreboard/setblock/summon

Similar creations

Join 9Minecraft News & Guides