mojira.dev
MC-243079

Setting worldspawn doesn't respect Y value / players always spawn at top-most block

I'm making a custom map in which the player, once dead, respawns in an area made for it. (The first picture shows the outside).

So I used the command ''/setworldspawn 64 104 177 0.0'' to make the player spawn in the spot I wanted to (second picture).

But after killing myself and testing it, the game respawns me in a platform above, which shouldn't be the case because I marked the Y value to be 103 and the block there it's a valid spawning point. (Third picture).

I have also tried reducing the Spawn Radius to 0 and to 1, but it behaved the same.

Related issues

Attachments

Comments

migrated
[media][media][media][media]
migrated

This is to ensure newly spawned players donvt spawn in caves and alike; only adventure mode will use the exact position to spawn.

Kinda weird how spawnradius ignores y though.

Moesh

This is a well-known mechanic. What you will have to do is instead catch the player on their first tick after being alive and teleport them to the correct location. I like to timeSinceDeath as a catch-all for this purpose.

migrated

Right! Thank you a lot.

migrated

This bug is the cause of MC-242348.

It has been a well-known mechanic since 1.13 that /setworldspawn will allow players to respawn as close to the set y value as possible, instead of on top of the highest block (like in 1.12). This works regardless of the spawnRadius set. From my brief testing, it seems to require at least a 1x3 location at any y value. If that is not met, the player is respawned at the next highest block. 

This behavior has been reverted to 1.12 behavior sometime in the development of 1.18 (which is unfortunate considering the stunning new cave generation making underground spawn points more enticing). /setworldspawn will now always pick the highest block in the column (including leaves, unlike 1.12).

Steps to Reproduce:

  1. Open a world between 1.13 and 1.17.1 and another in 1.18.1 (and another in 1.12 if you wish to compare)

  2. /setworldspawn

  3. /fill ~-20 ~10 ~-20 ~20 ~10 ~20 minecraft:stone

  4. /kill and respawn

  5. Repeat at any y value of your choosing with at least 1x3 space to spawn. Invalidate spawn location and the 1.13 - 1.17.1 game will pick the next highest valid location to respawn the player.

It's worked this way for 3 years. You probably should reopen this.

migrated

I second reopening it, namely because the setworldspawn command includes a y value as a parameter, implying that that value will actually be used. If it doesn't get used and isn't intended to be, then it should not exist as a parameter as to not cause confusion and to reflect the intended behavior. And setting the spawn radius to 0 also implies that being spawned anywhere outside a radius of 0 in 3D space (that is, the y included) is not intentional. The natural world spawn behavior is of course well known and is not what the bug is about (since this is artificially setting a world spawn with commands).

migrated

It does get used, in adventure mode respawning is on that exact position.

migrated

What's the point of leaving a comment if you're not going to check what was said by other people (including mojang) before you?

migrated

Mojang didn't address this properly and I had to find a solution elsewhere.

And your comment was only part right and only contributed to my confusion.

It only works the way one would naturally want it to work if the default game mode for a map is Adventure. It is only in that specific condition, as far as I know. Switching game mode to adventure in a map that's creative by default is not enough, apparently. It's still a ridiculous limitation but it's better than nothing.

migrated

(Unassigned)

Unconfirmed

(Unassigned)

1.18 Release Candidate 3

Retrieved