The bug
Ghasts cannot see you until you get near eye level with them. I've only noticed this with the new mob AI update in the latest snapshots, so I'm guessing the ghast has the same problem that all the other new AI mobs have: they can't see you too well along the y-axis. When you get almost eye level of the ghast, it will shoot.
Update: Tested in 1.14.4: They only aggro if you're on the same level, but once they're aggressive they'll shoot you from any height
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 4
relates to 2
Attachments
Comments 42
It seems to be a problem with all mobs with this new AI, they have trouble seeing the player across the y-axis.
@sniper1.1 That should just be added for all mobs
I don't think there is any mob that reacts to you shooting them if they can't see you
@Jon1337 I feel like some mobs that don’t see you do get provoked by being shot unless they are really far away. Maybe not. If not, it should apply to more mobs.
Confirmed for 10b