Happy Ghast Shoot Fireballs

Make It Possible For Happy Ghasts to Shoot Fireballs With Snowballs

Supported Versions:

1.21.6+

Commands by Row:

Row 1

1. [repeat] /execute as @a at @s if entity @e[type=minecraft:happy_ghast,distance=..4] if entity @e[type=snowball,distance=2..4] run summon fireball ^ ^ ^1
2. [chain] /execute as @a at @s if entity @e[type=minecraft:happy_ghast,distance=..4] if entity @e[type=fireball,distance=..8] if entity @e[type=snowball,distance=2..4] run data modify entity @e[type=fireball,distance=..8,limit=1] Motion set from entity @e[type=snowball,distance=2..4,limit=1] Motion
3. [chain] /execute as @a at @s if entity @e[type=minecraft:happy_ghast,distance=..4] if entity @e[type=snowball,distance=2..4] run playsound minecraft:entity.ghast.warn ambient @a ~ ~ ~
4. [chain] /execute as @a at @s if entity @e[type=minecraft:happy_ghast,distance=..4] if entity @e[type=snowball,distance=2..4] run playsound minecraft:entity.ghast.shoot ambient @a ~ ~ ~
5. [chain] /execute as @a at @s if entity @e[type=minecraft:happy_ghast,distance=..4] if entity @e[type=snowball,distance=2..4] run kill @e[type=snowball,distance=2..4,limit=1]

Preview

repeat
chain
chain
chain
chain

Video

Too lazy to copy and paste each command?