Avalanche Cellular Automata Physics

Replace tall vertical sand pillars with realistic cellular automata physics that make sand and red sand tumble outward into sloped pyramid dunes.

Java EditionComplex Contraptions & CinematicsHard22 commandsTested on a real 26.2 & 26.3 server
Falling sand and red sand spread outward into a natural mound inside a sandstone basin. Download the GIF Video & GIF © www.9minecraft.net

SimulationsNatureYellowOrangeLearningMap MakingBuilding ToolBlock displaysFalling blocksBlock building (fill/setblock/clone)21+ commands

In vanilla Minecraft, dropping sand from a single point stacks into a tall vertical tower. This command creation applies cellular automata physics to falling sand and red sand, causing unstable columns to slide outward and settle at a natural 45-degree angle of repose.

Watch as an overhead emitter pours alternating streams of sand and red sand onto the sandstone basin. Every time a block lands on a peak with open space beside it, it immediately tumbles down the slope in a dusty avalanche until a layered desert pyramid forms.

1. Setup - type these once 8 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /scoreboard objectives add c9_dir dummy
  3. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 smooth_sandstone
  4. /fill ~-9 ~ ~-9 ~9 ~ ~9 chiseled_sandstone
  5. /fill ~-8 ~ ~-8 ~8 ~15 ~8 air
  6. /summon marker ~ ~ ~ {Tags:["c9_ctrl"]}
  7. /scoreboard players set @e[tag=c9_ctrl] c9_timer 0
  8. /summon block_display ~-0.5 ~11.5 ~-0.5 {Tags:["c9_spawner"],Glowing:1b,glow_color_override:16755200,block_state:{Name:"minecraft:chiseled_red_sandstone"}}

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

  1. /scoreboard players add @e[tag=c9_ctrl] c9_timer 1
  2. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 150.. run scoreboard players set @e[tag=c9_ctrl] c9_timer 0
  3. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 run fill ~-8 ~ ~-8 ~8 ~10 ~8 air
  4. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 run kill @e[type=falling_block,tag=c9_sand]
  5. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 1 run kill @e[type=item,distance=..15]
  6. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 2 run fill ~-1 ~ ~-1 ~1 ~1 ~1 sand
  7. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 5..65 run summon falling_block ~ ~11 ~ {BlockState:{Name:"minecraft:sand"},Time:1,DropItem:0b,Tags:["c9_sand"]}
  8. /execute if score @e[tag=c9_ctrl,limit=1] c9_timer matches 66..115 run summon falling_block ~ ~11 ~ {BlockState:{Name:"minecraft:red_sand"},Time:1,DropItem:0b,Tags:["c9_sand"]}
  9. /execute as @e[type=falling_block,tag=c9_sand] unless score @s c9_dir matches 0..3 store result score @s c9_dir run random value 0..3
  10. /execute as @e[type=falling_block,tag=c9_sand,scores={c9_dir=0}] at @s unless block ~ ~-0.3 ~ air if block ~1 ~-0.3 ~ air if block ~1 ~-1.3 ~ air run tp @s ~1 ~ ~
  11. /execute as @e[type=falling_block,tag=c9_sand,scores={c9_dir=1}] at @s unless block ~ ~-0.3 ~ air if block ~-1 ~-0.3 ~ air if block ~-1 ~-1.3 ~ air run tp @s ~-1 ~ ~
  12. /execute as @e[type=falling_block,tag=c9_sand,scores={c9_dir=2}] at @s unless block ~ ~-0.3 ~ air if block ~ ~-0.3 ~1 air if block ~ ~-1.3 ~1 air run tp @s ~ ~ ~1
  13. /execute as @e[type=falling_block,tag=c9_sand,scores={c9_dir=3}] at @s unless block ~ ~-0.3 ~ air if block ~ ~-0.3 ~-1 air if block ~ ~-1.3 ~-1 air run tp @s ~ ~ ~-1
  14. /execute at @e[type=falling_block,tag=c9_sand] run particle dust{color:[0.92,0.75,0.45],scale:1.3} ~ ~0.3 ~ 0.35 0.2 0.35 0.02 2

How it works

Frames from the test run

Avalanche Cellular Automata Physics - frame 1Avalanche Cellular Automata Physics - frame 2Avalanche Cellular Automata Physics - frame 3

Recorded on our own test server: 47 frames at about 9.3 fps. Our image check saw: An overhead emitter drops sand and red sand into a sandstone basin, forming a spreading pyramid-like mound with dust particles.

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 a flat open area where you want the sand basin to appear.
  2. Run each of the 8 setup commands in your chat window to build the 19x19 sandstone basin, scoreboard objectives, and overhead emitter.
  3. Place a column or line of 14 Repeating Command Blocks set to Always Active nearby.
  4. Paste one loop command into each repeating command block.
  5. Watch the emitter pour sand and red sand that automatically slides down into a layered pyramid before resetting every 7.5 seconds.

Use it with real players

To apply this avalanche physics to any sand or red sand placed by players across your area, replace the two timed /summon falling_block loop commands with /execute as @e[type=falling_block,distance=..50] run tag @s add c9_sand and remove the 150-tick reset commands.

Remove it again 7 commands

  1. /kill @e[tag=c9_ctrl]
  2. /kill @e[tag=c9_spawner]
  3. /kill @e[tag=c9_sand]
  4. /scoreboard objectives remove c9_timer
  5. /scoreboard objectives remove c9_dir
  6. /fill ~-9 ~ ~-9 ~9 ~15 ~9 air
  7. /fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 grass_block

FAQ

Why does the command teleport the falling block by a full block instead of a small decimal?

In Minecraft, if a falling block lands while off-center from the block grid, it breaks into a dropped item instead of placing a solid block. Shifting by exactly 1 block keeps every grain aligned with the grid.

Can I change the steepness of the sand pile?

Yes. Right now it checks <code>~1 ~-1.3 ~ air</code> for a 1:1 slope (45 degrees). Checking two blocks down (<code>~1 ~-2.3 ~ air</code>) creates steeper cliffs, while checking only horizontally creates flatter dunes.

Commands used

/execute/fill/kill/particle/random/scoreboard/summon/tp

Similar creations

Join 9Minecraft News & Guides