Command block set spawn [duplicate]

This is the syntax:

/spawnpoint [player] [<x> <y> <z>]

With your example, it'd be something like:

/spawnpoint 8.462 4.00000 8.591

As stated by @XeroOl, decimals might not work here this way. If so, try replacing , (comma) with . (dots).

You can also just get to the location of it and type

/spawnpoint

That will set it to the exact position where you are.

Source


I cannot comment yet as I'm lacking reputation, but as I look at this after doing a heavy amount of typing, I think this deserves its own answer.

While Alex answered it well, they actually has a few problems in their first example:

  • They forgot to mention that the player must be specified if using a command block.
  • When using coordinates in commands, you cannot use a thousands separator. Fixing it, their example should be instead:
    /spawnpoint 8462 400000 8591
    but still, that high Y coordinate.. might not work...
    EDIT: This was clarified to me that the period that the Alex was using was probably for the decimal part of the location. Still won't work as I edited it, but my apologizes anyways.
  • You cannot place a spawn point where your feet would be in a block. Doesn't matter if it is a lower slab, grass or plant (any), or even a pressure plate.

So to further follow up on the command... if a player invoked it,

/spawnpoint [<player>] [<x> <y> <z>]

and if a command block invoked it,

spawnpoint <player> <x> <y> <z>

To have a pressure plate with a command block work to set it to that exact location, I'll post an example vertical slice layout here (with a command).

X
X
_
C

The X represents an air block, _ for the pressure plate, and C for the command block. Any other layout can work as long as you update the coordinates to work. You need to have actual air blocks to have it as a valid spawn point, two air blocks (as the player is 2 blocks tall by default), and always needing specify the foot location's coordinate when entering the spawn point.

I'm going to have it so just anyone within a 3 block radius of the target location to have their spawn point set (so it works better in multi-player custom adventure / puzzle maps). I'll also specify why I'm using the values I am using just for being helpful.

If, for example, your command block was at the coordinates (125,83,2568), this is what you would probably put in.

spawnpoint @a[x=125,y=85,z=2568,r=3] ~ ~2 ~

Within a command block, the opening / is normally ignored by the game.

First part:

  • @a - specifies all users, but we limit with the selector part within square brackets []
  • x=nnn, y=nnn and z=nnn - specifies where we are doing the center of our search at.
    Note: you must put the exact coordinates in as using the relative coordinate feature (~) does not work in a selector!
  • r=3 - specifies anyone at maximum 3 blocks away from the specified center will be affected, otherwise the @a will still affect everyone (I haven't tested. Can anyone confirm if this is true or if it instead would require the player to be on that exact spot?).

Second part just specifies where the command block will set the spawn point for the targeted player(s) (specified as x y z, in that order). ~ means use that coordinate relative to who / what invoked it (for us in this instance, the command block; gets more complicated if chaining with that one command, which would be where the last command was invoked) in the specified value. Pretending N is a number without commas or periods, ~-N would be for that coordinate minus N (further into the negative values), and for instead adding to the coordinate, ~N.

Finally, I must note that if you are using a non-vanilla server, you should look up how it works. Sometimes custom ones may use stuff like /tp as exact coordinates instead of centering on a block. Yes, odd, but it has existed in what I experienced.