setworldspawn is not spawning players to the exact place
I am trying to make a Minecraft map but I can't set the world spawn. I did /setworldspawn
then /kill
and I ended up 10 blocks away then I tried again I was still 5 blocks away.
In the map it needs to keep updating your spawn point and having it not not working correctly is not an option. In one case I set the spawn, and then ended up in the next level of my map, which is clearly not intended.
Solution 1:
Try using the a repeater with a command block that states: "/spawnpoint @a[r=<size of spawn from the center, outwards>] <x> <y> <z>
" This will ensure that people within the specified area (within the [r=<>]
circle) will have their spawnpoints set to the coordinates and as soon as they leave the range, they can set their spawnpoint anywhere else. No pressure plates or tripwires required.
Solution 2:
Look at the Minecraft-Wiki entry for Spawn.
Player Spawning
Since Minecraft version 1.3, players in both singleplayer and multiplayer will spawn, by default, anywhere within a 20x20 area centered at the world spawn point. An individual player can change their spawn point by merely lying in a bed—they do not have to go to sleep (which can only happen if all players use a bed at the same time). Unlike spawning at the world spawn, a player's spawn point is set at specific coordinates; the player will always respawn on the same block. This block is also where the player is placed when the player gets out of the bed. If there are transparent blocks over the spawn block, the player will be respawned on top on the blocks, but will get out of bed inside of them on the same level as the bed.
Emphasis mine. Setting only the worldspawn will not help you ,you need to set the players' spawnpoints. So the command you should be using instead is
/spawnpoint <player> <x> <y> <z>
which will actually set the spawnpoint as if sleeping in a bed (see Commands). Just use @a
to set it for every player at once.
As Rokk points out, this will not work for "Lobby" areas (i.e. where you will spawn when you first enter the world as a new player), since you need to run it for every player, and you can't run it before a player first spawns. For this case, I suggest a sufficiently large (i.e. 20x20 or greater) spawning area, set with /setworldspawn
. Note that you spawn on the top blocks in the set area, so building it underground will not work.