Minecraft wiki entry for Phantom, associated text: Phantoms spawn unless the gamerule doInsomnia is set to false. The spawning mechanics differ between Java and Bedrock editions. 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).[verify] This statistic is reset when the player dies or enters a bed. 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. Phantoms do not spawn in Spectator mode,‌[JE only] but they do spawn in Creative mode.