Minecraft wiki entry for Advancement_guide, associated text: Sleeping in a bed will reset the player's spawn point, so that when they die, they will respawn next to their bed. Note that this advancement can only be done at night or during a thunderstorm.