Steps to Reproduce
1. In survival mode, approach a ghast until it targets you and it's eyes and mouth turn red.
2. Quickly back out of range of the ghast, or switch to creative mode.
3. Move back in range or switch back to survival mode.
Expected Result
The ghast's face returns to normal after step (2), and after step (3) it turns red and makes its warning/charging sound again before shooting at you.
Observerd Result
The ghast's eyes and mouth remain red after step (2), and after step (3) it shoots at you instantly without any sound.
Original description
Whenever a ghast prepares spit a fireball at me, it continues holding its charge like a charged crossbow the moment I immediately back out of its vicinity. Once I return within its firing range and it looks at me, it silently releases its fireball at me. As you saw from the evidence, the fireball knocked me back quite a bit because it exploded on impact at my feet. On that note, what I’m really worried about is the fact that it can do it silently, which means that sneak-building or mining on a tiny ledge in a very high area with possibly a sea of lava at the bottom with a recently encountered ghast or two below you....is most likely going to translate into a death sentence.
Linked issues
is duplicated by
Attachments
Comments


It did the same to me but not necessarily when I moved, sometimes the ghast just turned away and then shot instantly as soon as it was facing me again

Affects 1.16.100.60

affects 1.17.20.22

affects 1.17.0

Affects 1.16.201

You can reproduce this easily by drinking invisibility.. the ghast's range of site will be reduced and you wont have to rush out of range

As reported by @unknown above, the suspended ghast attack can also happen because the ghast turns in its flight after it begins launching its fireball, which makes it lose eye contact with the player. I don't believe a ghast should break line of sight after it has begun its attack.

The reason for this bug, and the fix, is twofold:
1. Ghasts cannot uncharge attacks.
Once an entity begins charging a ranged using "minecraft:behavior.ranged_attack"
, the charging continues and the attack remains charged until either (a) the charge is fired, or (b) the behavior component is removed. So, when the ghast loses its target, it gets stuck in the charged state. This makes sense for charging a mechanism like a crossbow, but not for an organic attack like spitting a fireball. (Unless ghasts are supposed to be mechanical contraptions, which is one theory I've come across.)
The way to fix this is to put "minecraft:behavior.ranged_attack"
within a component group that gets added by an angry event and removed by a calm event. In turn, the angry event should be called by the component minecraft:on_target_acquired
, and the calm even should be called by the component minecraft:on_target_escape
. This makes ghasts lose their charges when they lose their targets. If a player moves out of range and back in, or behind a wall for long enough and then back in sight, the ghast has to re-charge and it will play the warning sound.
applies this fix.
2. Ghasts continue rendering their charging face after they finish charging, until they shoot or are reloaded.
Strangely, after applying the behavior pack fix above, ghasts continue to show their charged/warning face after they lose their targets. They only revert to the normal face if you relog or move far enough from the ghast that it is no longer rendered, and then move back. This rendering behavior is determined by the following line in the vanilla resource render_controllers\ghast.render_controllers.json:
"textures": [ "Array.skins[variable.ischarging]" ]
Apparently variable.ischarging
is set to TRUE when ranged attack charging begins and is not set to FALSE until the charge is fired or the client reloads the actor. The ghast face can be fixed to revert to normal when the ghast has no target by replacing the line above with
"textures": [ "Array.skins[ ( variable.ischarging && query.has_target ) ]"
I have applied this fix in
[media]. Note that if you only use the resource pack fix, ghasts' faces will return to normal when they stop targeting you, but they will retain their attack charge and shoot without warning when they target you again.

Affects 1.17.40.20

Affects 1.20.21 preview

Confirmed in 1.21.44
You can also do this by switching to creative mode.