Minecraft wiki entry for Ender_Dragon, associated text: When the dragon finally takes a fatal blow, she flies toward the exit portal structure before dying, unless she cannot find it within 150 blocks, or it is inside blocks.‌[Java Edition only]