Compass
A giant compass with heading labels. Another use of block printing and positions.
Try the code:
let north: Position = null
let south: Position = null
let west: Position = null
let east: Position = null
let up: Position = null
let down: Position = null
let p: Position = null
let length = 25
player.onChat("compass", function () {
p = player.position()
east = positions.add(p, pos(length, 0, 0))
blocks.fill(
OBSIDIAN,
p,
east,
FillOperation.Replace
)
blocks.print(
"EAST+X",
REDSTONE_BLOCK,
east,
EAST
)
west = positions.add(p, pos(-length, 0, 0))
blocks.fill(
OBSIDIAN,
p,
west,
FillOperation.Replace
)
blocks.print(
"WEST-X",
REDSTONE_BLOCK,
positions.add(west, pos(-30, 0, 0)),
EAST
)
up = positions.add(p, pos(0, length, 0))
blocks.fill(
OBSIDIAN,
p,
up,
FillOperation.Replace
)
blocks.print(
"UP+Y",
REDSTONE_BLOCK,
up,
EAST
)
down = positions.add(p, pos(0, -length, 0))
blocks.fill(
OBSIDIAN,
p,
down,
FillOperation.Replace
)
blocks.print(
"DOWN-Y",
REDSTONE_BLOCK,
down,
EAST
)
north = positions.add(p, pos(0, 0, -length))
blocks.fill(
OBSIDIAN,
p,
north,
FillOperation.Replace
)
blocks.print(
"NORTH-Z",
REDSTONE_BLOCK,
north,
EAST
)
south = positions.add(p, pos(0, 0, length))
blocks.fill(
OBSIDIAN,
p,
south,
FillOperation.Replace
)
blocks.print(
"SOUTH+Z",
REDSTONE_BLOCK,
south,
EAST
)
})