Minecraft – How to rotate the clickable sign in Minecraft

minecraft-commandsminecraft-java-edition

I made a command which creates a clickable sign that teleports a player to spawn. Here is the command:

/setblock ~ ~1 ~ minecraft:wall_sign 0 replace {Text1:"{text:\"Start\",clickEvent:{action:run_command,value:\"/tp @p[c=1] -658 104 -690\"}}"}

When I start the command block, it places the sign backwards from the wall, meaning it is on the right block, but is not connected to the wall. How can I alter this command so the the sign is rotated to be connected to the wall?

Best Answer

In /setblock, you should alter the sign's [dataValue] (argument after <TileName>) to change its rotation.

For wall signs:

 dataValue  ║ Direction
 ══════╬══════
 2               ║ north
 3               ║ south
 4               ║ west
 5               ║ east

As you said the default direction (facing north) is the opposite of the direction you want it to face, to have it face south your command should look something like this:

/setblock ~ ~1 ~ minecraft:wall_sign 3 replace {Text1:"{\"text\":\"Start\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tp @p[c=1] -658 104 -690\"}}"}

Also, I added quotes around all of the strings. This makes the command comply with strict JSON parsing, and will keep it working after the 1.9 update (should also still work in 1.8).