Sand Storm

Introduction

Want to throw some sand around? Make a small sand storm in this tutorial. You will learn to place a block of sand at a position and then use ||positions:pick random position|| to make sand appear somewhere at random near you. Finally, a ||loops:repeat|| block is used to make lots of sand show up like a storm!

Chat command

Put in an ||player:on chat command|| and rename it to sandstorm.

player.onChat("sandstorm", function () {
})

Add sand

Put a ||blocks:place|| inside to create some sand at 10 blocks above your position (~0 ~10 ~0).

player.onChat("sandstorm", function () {
    blocks.place(SAND, pos(0, 10, 0))
})

Use your new command!

Go to Minecraft, press t to open the chat and enter sandstorm. You should see a block at your position.

Random positions

Put a ||positions:pick random position|| in the ||blocks:place|| to add some unpredictability.

player.onChat("sandstorm", function () {
    blocks.place(SAND, randpos(
        pos(0, 0, 0),
        pos(0, 0, 0)
    ))
})

From here to there

Edit the positions of the ||positions:pick random position|| to select a position above the player.

player.onChat("sandstorm", function () {
    blocks.place(SAND, randpos(
        pos(-10, 10, -10),
        pos(10, 10, 10)
    ))
})

Use your sandstorm command!

Go to Minecraft and enter sandstorm in the chat. You should see a block of sand fall from the sky.

Repeat

Put a ||loops:repeat|| loop around the ||blocks:place|| to repeat it 100 times.

player.onChat("sandstorm", function () {
    for(let i = 0; i < 100; i++) {
        blocks.place(SAND, randpos(
            pos(-10, 10, -10),
            pos(10, 10, 10)
        ))
    }
})

Get it a try!

Go to Minecraft and enter sandstorm in the chat. Watch out for sand!