From what I can tell, this happens when the ghast is a bit too low in the 5x5 area.
This can easily be replicated by using a spawn egg on the bottom center block of the spawn box. In my test I used a 7x7 box (5x5 air inside) suspended in the air and you can tell the tentacles are tangling quite a bit out the bottom when it's in the right position.
This also only seems to happen in the North-West direction and is very predictable. The actual problem seems to be happening in the ray tracing method in World with a signature (Vec3, Vec3, bool, bool).
Edit: To be more exact, the reason it is happening is because ghast is attempting to check if it can "see" the player. Since the ray tracing is not detecting blocks in the path, it thinks it has line of sight.
From what I can tell, this happens when the ghast is a bit too low in the 5x5 area.
This can easily be replicated by using a spawn egg on the bottom center block of the spawn box. In my test I used a 7x7 box (5x5 air inside) suspended in the air and you can tell the tentacles are tangling quite a bit out the bottom when it's in the right position.
This also only seems to happen in the North-West direction and is very predictable. The actual problem seems to be happening in the ray tracing method in World with a signature (Vec3, Vec3, bool, bool).
Edit: To be more exact, the reason it is happening is because ghast is attempting to check if it can "see" the player. Since the ray tracing is not detecting blocks in the path, it thinks it has line of sight.