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.
Minecraft – Where is bed data stored
minecraft-java-edition
Related Topic
- Minecraft – how to get and store player name
- Minecraft – Give player item(s) when player hits X amount of deaths
- Minecraft – Random spawn location despite sleeping in a bed
- Minecraft – How to stop players from spawning at their beds in Minecraft 1.14
- Minecraft – ny way to add a “wildcard” text to an execute command
- Minecraft – the correct way of using /data merge on entity tags such as Passengers and Tags and Team
Best Answer
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.