1
How to set a exact spawn point with commandblocks
hello, i've seen this question a lot before and i finally found an answer. when you do
/set worldspawnpoint it makes you spawn within 30 blocks from the desired point. if you want to spawn in a specific spot you need a repeating command block. you can get this by doing /give [username] minecraft:repeating_command_block. then place it and turn it to always active. then type /testfor @a. now press done then put a comparator facing away from it then put a regular commandblock in front of it. you can get this by doing
/give [username] minecraft:command_block. then type /tp @a [x] [y] [z]. to test if it works log off the world then go back on. you should be at the exact coordinates you put in the second command block. i hope this helped you.
EDIT: ive seen this in the comments 2 times already so if you want to make it so you spawn in creative/adventure/spectator then add another commandblock next to the commandblock with the tp command in it. then type in /gamemode [gamemode]
the easiest way i found in the comments was by Gealx3 he said turn /gamerule spawnRadius 0 which i find the easiest way to do this.
/set worldspawnpoint it makes you spawn within 30 blocks from the desired point. if you want to spawn in a specific spot you need a repeating command block. you can get this by doing /give [username] minecraft:repeating_command_block. then place it and turn it to always active. then type /testfor @a. now press done then put a comparator facing away from it then put a regular commandblock in front of it. you can get this by doing
/give [username] minecraft:command_block. then type /tp @a [x] [y] [z]. to test if it works log off the world then go back on. you should be at the exact coordinates you put in the second command block. i hope this helped you.
EDIT: ive seen this in the comments 2 times already so if you want to make it so you spawn in creative/adventure/spectator then add another commandblock next to the commandblock with the tp command in it. then type in /gamemode [gamemode]
the easiest way i found in the comments was by Gealx3 he said turn /gamerule spawnRadius 0 which i find the easiest way to do this.
Create an account or sign in to comment.
15
1
I have no idea what that does but it probably works
2
/setworldspawn posX posY posZ
/gamerule spawnRadius 0 /* Spread radius = 0, equal to exact posX posY posZ */
/* If player specific spawnpoint is required: */
/spawnpoint @p[<insert_parameter_here>] diffPosX diffPosY diffPosZ
"/spawnpoint" overrides default spawn point (worldspawn) for each player entry, and sets to the exact position (diffPosVar).
"... spawnRadius 0" overrides default spread from spawn point to 0 (as explained, to exact posVar positions).
There's absolutely no reason to constantly loop commands.
1
Ok! Well then I guess this answers the question...
1
yes of course you can because the command block use the command like the chat with "/" but in command block you don't need to place "/"
1
But can you use it in a command block?
1
you can run /spawnpoint @a <X,Y,Z> in an always active repeating command block you know
1
Gealx3's answer is still better because it doesn't override player specific spawns.
2
You could just do /gamerule spawnRadius 0. The only time that wouldn't work is if you wanted the spawn point underground or under a ceiling of some kind though.
1
Wow, this is probably the best solution so far. I thought the spawnRadius only meant the amount of loaded chunks, but indeed it's the spread radius. Confirmed by the minecraft wiki.
Compared to other solutions, this doesn't have initial commands AND doesn't ignore player specific spawnpoints. So yeah, this is probably the best solution.
Compared to other solutions, this doesn't have initial commands AND doesn't ignore player specific spawnpoints. So yeah, this is probably the best solution.
1
WARNING
THIS IS NOT WORKING AND COULD BUG YOUR WORLD
What you are doing is basically testing if anyone is there. If there is, you would be tped once. So everytime the server goes empty, the test returns false. Next time anyone joins he will be tped to that location. This has nothing to do with whether or not you die.
Instead, use /defaultgamemode adventure to make sure everyone spawns exactly at the worldspawn instead of around it (IF they have no spawnpoint yet).
----
Also, you can use the following commands to make the players spawn at a certain point, ignoring player spawns and removing the trouble of doing /gamemode for each new player.
Once:
/scoreboard objectives add death deathCount
On clock:
/tp @a[score_death_min=1] [x] [y] [z]
/scoreboard players reset @a[score_death_min=1] death
THIS IS NOT WORKING AND COULD BUG YOUR WORLD
What you are doing is basically testing if anyone is there. If there is, you would be tped once. So everytime the server goes empty, the test returns false. Next time anyone joins he will be tped to that location. This has nothing to do with whether or not you die.
Instead, use /defaultgamemode adventure to make sure everyone spawns exactly at the worldspawn instead of around it (IF they have no spawnpoint yet).
----
Also, you can use the following commands to make the players spawn at a certain point, ignoring player spawns and removing the trouble of doing /gamemode for each new player.
Once:
/scoreboard objectives add death deathCount
On clock:
/tp @a[score_death_min=1] [x] [y] [z]
/scoreboard players reset @a[score_death_min=1] death
1
1. it hasnt buged for me
2. this is mainly for map makers so people will spawn in the spawn room so it shouldn't matter if you die. if they wanted people to spawn somewhere else once the player dies the way you suggest could be a better way but this is just so they spawn into the world in the right place.
3.if you do /defaultgamemode adventure you would spawn at the point the world automatically sets it to which means you will have to get mcedit and thats impossible to get if your a linux user like me
4.the death count way could be used for regular survival but if your a map maker you would re spawn in the start room so every time the player dies he/she will need to start over
2. this is mainly for map makers so people will spawn in the spawn room so it shouldn't matter if you die. if they wanted people to spawn somewhere else once the player dies the way you suggest could be a better way but this is just so they spawn into the world in the right place.
3.if you do /defaultgamemode adventure you would spawn at the point the world automatically sets it to which means you will have to get mcedit and thats impossible to get if your a linux user like me
4.the death count way could be used for regular survival but if your a map maker you would re spawn in the start room so every time the player dies he/she will need to start over
1
1. okay
2. This was not clear from your story, spawning includes reviving after death. And besides, if you re-load the world (e.g by going back to the menu on Single Player) this DOES indeed trigger again and teleport the player AGAIN.
3. You can do /setwoldspawn.
4. This is not just for survival, it's for any map including a respawn after death. You are right about the coordinates not being changeable, but the same goes for your solution. Your /tp command is just as static as my /tp command applied in different situations.
2. This was not clear from your story, spawning includes reviving after death. And besides, if you re-load the world (e.g by going back to the menu on Single Player) this DOES indeed trigger again and teleport the player AGAIN.
3. You can do /setwoldspawn.
4. This is not just for survival, it's for any map including a respawn after death. You are right about the coordinates not being changeable, but the same goes for your solution. Your /tp command is just as static as my /tp command applied in different situations.
1
Um, you know there's a /spawnpoint command right? Or am I missing something?
1
when you do
/set worldspawnpoint it makes you spawn within 30 blocks from the desired point.
and if you do just /spawnpoint then you will have to do it for every individual player that comes on
/set worldspawnpoint it makes you spawn within 30 blocks from the desired point.
and if you do just /spawnpoint then you will have to do it for every individual player that comes on
1
This is also a solution, but it requires to set the spawnpoint every time.
Compared to the solutions above:
Defaultgamemode solution:
- Requires command for new players (/gamemode)
Scoreboard solution:
- Ignores playerspawns
Spawnpoint solution:
- Requires command for new players (/spawnpoint)
Compared to the solutions above:
Defaultgamemode solution:
- Requires command for new players (/gamemode)
Scoreboard solution:
- Ignores playerspawns
Spawnpoint solution:
- Requires command for new players (/spawnpoint)