Minecraft wiki entry for Bed, associated text: If the player has not entered a bed or didn't die for 3 in-game days, phantoms can spawn unless /gamerule doInsomnia is set to false. in Java Edition, this can be verified by checking if the "Time Since Last Rest" statistic is greater than 1.00 h.