Phantom

"This manta-ray–like monster is a flying creature that spawns at high altitudes. It is attracted to insomnia, and will find players who haven't slept for many days. It will swoop down in groups and bite your flesh."

- Jens Bergensten

Phantoms are undead hostile mobs that spawn when the player has not slept in over three in-game days.

Spawning
Phantoms spawn unless the game rule  is set to. The spawning mechanics differ between Java and Bedrock editions. In both editions, they spawn in the Overworld above the player if the "since last rest" statistic is at least 1 hour (72000 ticks or 3 in-game days). This statistic is reset when the player enters a bed or dies. 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 will not spawn in spectator mode, but will spawn in creative mode.

Bedrock Edition
Phantoms spawn if the player's Y-coordinate is between 1 and 129. They are rarer if the player is at the extreme ends of this range, and most common if the player is at Y=75.

Phantom spawning is similar to other monsters spawning; the spawn location must have a light level of 7 or less, and they spawn according to the hostile mob density cap. However, phantoms can spawn only on the surface, and they spawn high above the spawn location rather than directly at it (the exact height is unknown).

Java Edition
Phantoms attempt to spawn every 1–2 minutes. They spawn only if it is night or a thunderstorm is happening, the player is above sea level (y=64), and the local difficulty is greater than a randomly chosen value between 0.0 and 3.0. The chance of a successful spawn is $x−72000⁄x$, where x is the number of ticks since the player last entered a bed or died. This roughly comes to a $1⁄4$ chance on day 4, a $2⁄5$ chance on day 5, a $3⁄6$ ($1⁄2$) chance on day 6, $4⁄7$ chance on day 7, and so on.

If all conditions are met, a group of phantoms attempt to spawn 20–34 blocks above the player, and off to the side by a taxicab distance of up to 10 blocks. The number of phantoms spawned is 1-2 in Easy difficulty, 1-3 in Normal, and 1-4 in Hard.

Phantoms are counted toward the hostile mob cap, but don't adhere to it when spawning. Their spawning mechanic is based on the location of players in the world rather than by chance, unlike regular mob spawning.

Drops
Phantoms drop when killed:
 * 0–1 s when killed by a player or tamed wolf. Looting increases the maximum drops by 1 per level, for a maximum of 4 with Looting III.
 * when killed by the player or a tamed wolf.

Behavior
When idle, phantoms fly around in a circle at a constant y-elevation, leaving a trail of gray smoke while doing so. They have a large search radius, and occasionally swoop down or up quickly to attack their victim. If stopped or hurt during this action, the phantom retreats back to its original elevation. When a path to its original elevation is obstructed by a block, the phantom continues attempting to return to its original elevation until it either attacks or moves out from under the block.

Phantoms are able to move through water at their normal speed, and cannot drown.

A phantom's body disappears when under the Invisibility effect, but its eyes and smoke particles are still visible.

Like zombies and skeletons, phantoms burn in sunlight.

Cats hiss at phantoms that are currently attacking players, and phantoms try to stay at least 16 blocks away from them. $$, phantoms also avoid ocelots in the same manner.

Undead
Like other undead mobs, phantoms are harmed by the Instant Health effect, healed by the Instant Damage effect, immune to the Poison and Regeneration effects, ignored by the wither, and affected by the smite enchantment.

Data values
Phantoms have entity data associated with them that contain various properties of the mob.

Trivia

 * The phantom was added into the game as a result of winning the MINECON Earth mob Twitter poll as "Mob B".
 * Phantoms are currently the fastest non-boss mob in the game, traveling at speeds of up to 20.83 blocks per second.
 * At one point before the release of 18w10a, the phantom texture was made red, but it was decided that it appeared too much like a Nether mob.
 * The phantom was originally going to have a mouth, like the sketch shown during MINECON Earth, but it was eventually scrapped because "it looked so much like a muppet". Earlier designs can be seen on Minecraft's Instagram account.
 * Phantoms are the second mobs to fear cats, with first being Creepers.