how to set a exact spawn point with commandblocks

Such an intricate part of Minecraft that it deserves a whole section dedicated to it. Post your most amazing Redstone creations here!

Post Permalink
by xXka3lXx » 7/17/2017

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. :D

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.
Last edited by xXka3lXx on 7/20/2017, edited 2 times in total.
User avatar
Level 7
Apprentice Miner
Posts: 17
Joined: 4/8/17
Location: Corvallis, Oregon
Minecraft: xXka3lXx

Post Permalink
by Greystalk » 7/18/2017

Um, you know there's a /spawnpoint command right? Or am I missing something?
Image

Image
User avatar
Level 16
Journeyman Ranger
Posts: 121
Joined: 4/15/16

Post Permalink
by Bertiecrafter » 7/18/2017

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
Last edited by Bertiecrafter on 7/18/2017, edited 1 time in total.
Image
User avatar
Level 28
Expert Engineer
Posts: 466
Joined: 2/15/15
Minecraft: Bertiecrafter

Post Permalink
by Bertiecrafter » 7/18/2017

Greystalk wrote:Um, you know there's a /spawnpoint command right? Or am I missing something?

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)
Image
User avatar
Level 28
Expert Engineer
Posts: 466
Joined: 2/15/15
Minecraft: Bertiecrafter

Post Permalink
by Gealx3 » 7/18/2017

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.
Image
User avatar
Level 53
Grandmaster Artist
Posts: 226
Joined: 7/23/12
Says: Says: Enter your status, tag line, motto, whatever.
Minecraft: Gealx3

Post Permalink
by xXka3lXx » 7/19/2017

Bertiecrafter wrote: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


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
User avatar
Level 7
Apprentice Miner
Posts: 17
Joined: 4/8/17
Location: Corvallis, Oregon
Minecraft: xXka3lXx

Post Permalink
by xXka3lXx » 7/19/2017

Greystalk wrote:Um, you know there's a /spawnpoint command right? Or am I missing something?


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
User avatar
Level 7
Apprentice Miner
Posts: 17
Joined: 4/8/17
Location: Corvallis, Oregon
Minecraft: xXka3lXx

Post Permalink
by Bertiecrafter » 7/20/2017

Gealx3 wrote: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.


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.
User avatar
Level 28
Expert Engineer
Posts: 466
Joined: 2/15/15
Minecraft: Bertiecrafter

Post Permalink
by Bertiecrafter » 7/20/2017

xXka3lXx wrote:
Bertiecrafter wrote: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


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


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.
Image
User avatar
Level 28
Expert Engineer
Posts: 466
Joined: 2/15/15
Minecraft: Bertiecrafter

Post Permalink
by RSMike » 7/20/2017

you can run /spawnpoint @a <X,Y,Z> in an always active repeating command block you know
User avatar
Level 14
Journeyman Crafter
Posts: 1
Joined: 3/21/16

Post Permalink
by Bertiecrafter » 7/20/2017

RSMike wrote:you can run /spawnpoint @a <X,Y,Z> in an always active repeating command block you know


Gealx3's answer is still better because it doesn't override player specific spawns.
Image
User avatar
Level 28
Expert Engineer
Posts: 466
Joined: 2/15/15
Minecraft: Bertiecrafter

Post Permalink
by BenceTheGreat » 7/20/2017

But can you use it in a command block?
User avatar
Level 1
New Crafter
Posts: 8
Joined: 7/18/15

Next

Return to Redstone