mojira.dev
MC-147694

Mobs no longer get repelled by shields

The bug

Ever since the beginning of 1.14 snapshots, mobs wouldn't get knocked back when a player is blocking with a shield.
Here are some screenshots from the current version (1.13.2) and current snapshot (19w14b)

1.13.2:

  • Vindicators

  • Piglin (New Mob in 1.16.x)

  • Zombie Pigman/Zombified Piglin (renamed in 1.16.x)

  • Zombie Villager

  • Zombie

  • Husk

  • Drowned

  • Wolf

  • Wither Skeleton

  • Enderman

  • Spider & Cave Spider

  • Silverfish

  • Slime and Magma Cube

These mobs do knockback when you're blocking.

19w14a & b and beyond of 1.14 - 1.16:
The mobs I said above don't do knockback in the current version(s).
However, this doesn't affect to Creeper/TNT explosions, as you still do knockback from it. And arrows from Skeletons/Strays will still bounce of the shield.

Code analysis

Code analysis by @unknown & @unknown can be found in this comment and this comment.

Linked issues

Attachments

Comments 44

Still confirmed for 1.14 Pre-release 1

Still an issue for 1.14 Pre-Release 2

Confirmed for 1.14 Pre-Release 4

Confirmed for 1.14 Pre-Release 5

Still an issue in 1.14.2 

34 more comments

Can confirm in 1.21.9 and 25w35a

Can confirm in 25w41a

Can confirm in 25w42a

Still in 26.1 snapshot 7.

This mod can fix this bug. https://modrinth.com/mod/shieldsknockback/versions

If developer wants to remove the shield-knockback, why not add components for players to choose? It’s a really bad idea to transfer the knockback to the blocker and stopped by the shield-blocking-damage-tick.

Still in 26.2-snapshot-8.

This knockback gets applied into the player itself. Try to block the laser of a guardian, then player get a strange knockback towards the guardian.

in net\minecraft\world\entity\LivingEntity.class, protected void blockedByItem():

This is the origin code that cause the wrong knockback:

Origin147694.png

According to the comments below, change the order defender.getX/Z() and this.getX/Z().

Change147694.png

migrated

(Unassigned)

Confirmed

Gameplay

Low

Player

Minecraft 19w12b, Minecraft 19w13b, Minecraft 19w14a, Minecraft 19w14b, Minecraft 1.14 Pre-Release 1, , 1.20.4, 1.21, 1.21.1, 1.21.2 Pre-Release 2, 24w45a

Retrieved