3

In Minecraft, players use a bed to set their spawn point. If they die and the bed is gone, they are sent back to the world spawn. However, I was wondering where this data is stored and how that affects game play. If a player sleeps in a bed to set their spawn, destroys the bed, and immediately puts it back in the same place, does that destroy their spawn? If the data is stored with the bed block, it would. If the data is stored with the player data, it might not. But I haven't been able to find any information about immediate bed replacement anywhere.

4

The best way to try to figure out how this works is with some SCIENCE. To test this, I set my spawn in a bed in my test world. Then, I broke the bed, and placed it back in exactly the same position it was in when I set my spawn there (I used some wool to mark where the bed was and how it was oriented). When I used /kill, I respawned at the bed. However, if I break the bed, use /kill, and then replace it in the spot it was before, after having died, my spawn is no longer set.

The coordinates of the player's bed are stored in the Player.dat file. Upon respawning, the game checks to see if the bed is still there, and if there is a valid spawning space around it. If the bed is at those coordinates upon death, and there is a valid spawning space, the player will spawn there. Even if the bed had been broken. If the bed is missing or obstructed upon respawning, the bed coordinates are cleared.

  • After looking through the MC source in my modding environment, I can confirm this is exactly what it's doing. The coordinates of the bed are stored with the player, then on death and only on death it validates those coordinates to determine if there's a bed there and spawning is possible. For the record, they probably chose to do it that way to allow despawning -- if the chunk the bed is in despawns, it would mess things up if the state were stored with the bed. – Morgan Patch Sep 25 '14 at 7:33
0

Depending on game version, breaking and replacing a bed can reset a spawn, (currently doesn't reset). However, the data is stored in the world's metadata, not the blocks of the bed, as you still spawn next to the bed if it is in an unloaded chunk, and can you change spawn points with commands.

  • That would make sense, storing that in the world data would allow for changes in unloaded chunks or with logged off players. Griefers who break beds and put them right back could ruin a player's day without them ever knowing it. – user137 Sep 24 '14 at 22:51
-1

The bed data is stored with that instance of the bed block. So if you break it and then immediately replace it, you would still spawn at the world spawn as the newly placed bed would be a new instance of a bed block.

  • 3
    I can't check right now, but I think this is wrong. Or my memory is wrong. – Arperum Sep 24 '14 at 17:02
  • It's true. It is sometimes used in some pvp games to fool players into thinking they still have a respawn point. – Fungo Sep 24 '14 at 21:12
  • 1
    I am getting consistent results in my test world that this is NOT the case. If a bed is broken and replaced in exactly the same spot before that player dies, then the player will respawn there upon death. – Unionhawk Sep 25 '14 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.