Here are the specific commands used in the command block.
1./execute as @e[type=guardian] at @s run tp @s ~~~ , Repeat, Always Active
2./structure load fireball ~ ~3 ~ , Impulse, Needs Redstone. Before using this command, please save a fireball with a structural block
3./execute as @e[type=guardian] at @s run damage @e[type=fireball] 0 entity_attack entity @s[c=1] , Impulse, Needs Redstone
4. tp @ e [type=! Player]~~1~ , Impulse, Needs Redstone
Afterwards, use the spawn egg to summon a guardian, then use a lever to activate all impulses command blocks in the order.
About the second question, this issue occurs on Android phones.
I apologize for my negligence, the report has been updated.
Here are the specific commands used in the command block.
1./execute as @e[type=guardian] at @s run tp @s ~~~ , Repeat, Always Active
2./structure load fireball ~ ~3 ~ , Impulse, Needs Redstone. Before using this command, please save a fireball structure called a fireball using structural blocks.
3./execute as @e[type=guardian] at @s run damage @e[type=fireball] 0 entity_attack entity @s[c=1] , Impulse, Needs Redstone
4. tp @e [type=!player] ~~1~ , Impulse, Needs Redstone
Afterwards, use the spawn egg to summon a guardian, then use a lever to activate all impulses command blocks in the order.
About the second question, this issue occurs on Android phones.