The Bug
When blocking a guardian laser with a shield, the magic penetrates the shield and inflicts damage, but the magic doesn't knock back the player correctly. Instead of knocking the player back, the player is knocked towards the guardian or elder guardian.
Steps to Reproduce
Obtain a shield and switch into survival mode.
Summon a guardian nearby.
/summon minecraft:armor_stand ~ ~ ~ {Passengers:[{id:"minecraft:guardian"}]}
When the guardian notices you, make sure that you're facing in its direction and start blocking with the shield.
When you block its attack using the shield, take note as to whether or not guardians inflict inverted knockback to their opponents when blocking their attack with shields.
Observed Behavior
Guardians inflict inverted knockback to their opponents (the knockback inflicted pushes you closer to the guardian, instead of away from it) when blocking their attack with shields.
Expected Behavior
Guardians would not inflict inverted knockback to their opponents when blocking their attack with shields. Instead, the knockback inflicted from blocking a guardian's attack should push you away from them, not closer to them.
Related issues
is duplicated by
Attachments
Comments

Relates to MC-181738
Can confirm in 1.16.3.

This might be a consequence of MC-147694.
Can confirm for 20w46a.
Can confirm in 20w51a.
Can confirm in 21w07a.
Can confirm in 1.17.1.
Can confirm this behavior in 21w42a. Here are some extra details regarding this problem.
The Bug:
Guardians inflict inverted knockback to their opponents when blocking their attack with shields.
Steps to Reproduce:
Obtain a shield and switch into survival mode.
Summon a guardian nearby.
/summon minecraft:armor_stand ~ ~ ~ {Passengers:[{id:"minecraft:guardian"}]}
When the guardian notices you, make sure that you're facing in its direction and start blocking with the shield.
When you block its attack using the shield, take note as to whether or not guardians inflict inverted knockback to their opponents when blocking their attack with shields.
Observed Behavior:
Guardians inflict inverted knockback to their opponents (the knockback inflicted pushes you closer to the guardian, instead of away from it) when blocking their attack with shields.
Expected Behavior:
Guardians would not inflict inverted knockback to their opponents when blocking their attack with shields. Instead, the knockback inflicted from blocking a guardian's attack should push you away from them, not closer to them.
Can confirm in 1.18.2 and 22w18a.
confirmed in 1.12.1 and 24w35a