instantly from the moment the player sleeps until the next morning. If there are monsters within 5m of the player, you won't be
able to sleep. Be careful where you place your bed, though: you'll bump your head painfully if you don't have at least 3m in the
room where your bed is.
In addition to passing the night, sleeping also changes the player's spawn point. The next time the player dies, so long as the
bed hasn't been broken, the player will spawn next to the bed.