I want to know how I can use /setblock
to spawn repeaters facing different directions. Like if I wanted to have a repeater facing east what command do I write?
2 Answers
You can set a block to repeater via this command:
/setblock ~ ~ ~ minecraft:unpowered_repeater
That places a repeater facing north, with a one tick delay. If you want to create a different repeater you have to calculate a datavalue, with this formula:
datavalue = direction + (4 * delay)
Where the delay goes from 0 to 3, and the direction goes like this:
- 0: North
- 1: East
- 2: South
- 3: West
For example, if you want to create a repeater facing east with the least amount of delay you calculate:
datavalue = 1 + (4 * 0) = 1
To then create that repeater execute this command:
/setblock ~ ~ ~ minecraft:unpowered_repeater 1
Minecraft 1.13 and newer versions no longer rely on cryptic numbers to encode things like facing, meaning that you can just do /setblock x y z repeater[facing=east]