Phantom spawn attempts are made on surface blocks throughout the same spawn radius as other monsters. Phantoms are also subject to a density cap of 5. Phantom spawning is similar to other monsters spawning: the spawn location must have a light level of 7 or less, and spawns are limited by the monster population cap. Phantoms do not spawn in Spectator mode, but they do spawn in Creative mode. Furthermore, the player must not have a block overhead that blocks light in any way for example, leaves prevent phantoms from spawning as they have a light opacity of 2, but glass does not, as its light opacity is 0. This statistic is reset when the player dies or enters a bed. In both editions, they spawn in the Overworld above the player if the 'Time Since Last Rest' statistic is at least 1 hour (72000 ticks or 3 in-game days). The spawning mechanics differ between Java and Bedrock editions. Phantoms spawn unless the game rule doInsomnia is set to false.