Gold stairs
Introduction
Climb higher and go for the gold! You will build some stairs out of gold blocks in this tutorial. The builder tool will do the work by placing gold blocks where you tell it to. You will build a golden stairway to the sky.
Chat command
Put in an ||player:on chat command||
and rename it to goldstairs.
player.onChat("goldstairs", function () {
})
Teleport the builder
Insert a ||builder:builder teleport to||
into the chat command to teleport the player
to your position.
The builder is similar to the agent but invisible.
player.onChat("goldstairs", function () {
builder.teleportTo(pos(0, 0, 0))
})
Stair step motion
Put two ||builder:builder move||
below ||builder:builder teleport to||
to move forward and up.
To build a single stair, we tell the builder to move forward, then up, then forward, then up…
player.onChat("goldstairs", function () {
builder.teleportTo(pos(0, 0, 0))
builder.move(FORWARD, 1)
builder.move(UP, 1)
})
Trace with gold blocks
Add a ||builder:builder trace path||
to tell the builder to fill the path with gold blocks.
player.onChat("goldstairs", function () {
builder.teleportTo(pos(0, 0, 0))
builder.move(FORWARD, 1)
builder.move(UP, 1)
builder.tracePath(GOLD_BLOCK)
})
Give it a try!
Go to Minecraft, type t to open the chat and enter goldstairs. You should see 3 new gold blocks appear.
Make more stair steps
Now, get a ||loops:repeat||
loop with 25
times and put it
around all of the ||builder:builder move||
to build 25 stairs.
player.onChat("goldstairs", function () {
builder.teleportTo(pos(0, 0, 0))
for (let i = 0; i < 25; i++) {
builder.move(FORWARD, 1)
builder.move(UP, 1)
}
builder.tracePath(GOLD_BLOCK)
})
Take a look!
Go to Minecraft and enter goldstairs in the chat. You should see a long gold block staircase get created.
Teleport players
Add in a ||mobs:teleport to position||
to teleport all players
to the base of the stairs.
mobs.teleportToPosition(
mobs.target(ALL_PLAYERS),
pos(0, 0, 0)
)
Set Creative Mode
Add a ||gameplay:set game mode||
at the end to switch all players to creative
mode.
gameplay.setGameMode(
CREATIVE,
mobs.target(ALL_PLAYERS)
)
Try out the game!
Go to Minecraft and enter goldstairs in the chat. The first player to the top wins!
builder