Ignore what [B] guardian10_[/B] said beds do not allow you to set spawn point. If you die you will always go to spawn. But beds will provent Phantoms to stop attacking you regardless if you sleep through the night or not it only takes a few seconds and they are also very useful for netherite mining.