Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-235198

Attribute "attack_knockback" doesn't apply knockback consistently to attacks blocked by shields

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.17.1, 21w43a, 1.18.1, 22w06a, 22w15a, 1.19 Pre-release 4, 1.19, 1.19.4, 23w18a, 1.20.2, 23w44a
    • None
    • Community Consensus
    • Commands
    • Low
    • Platform

      The attribute minecraft:generic.attack_knockback doesn't seem to be working in a consistent way when using shields. If a mob has X value of attack knockback above 0, the knockback applied to a player blocking isn't proportional to the attribute value.

      Observed behavior

      Wardens, Ravagers, Hoglins & Zoglins support the attack_knockback attribute and have X value by default, but there are some mobs that manage to work with this attribute (i.e. zombies, spiders, etc) althought there are exceptions (MC-180199). Here are the inconsistencies i noticed:

      1.- If a mob with AK (attack_knockback) has said attribute value above 0, the knockback works fine on attacks, but if they are blocked by a shield the knockback isn't affected by this value. Wardens fall in this category.
      Example: An endermite with an AK of 5 applies a lot of knockback to the player but if the player is blocking it would be as if the mob still had an AK value of 0, the player doesn't move at all.

      2.- Ravager knockback applied to the shield isn't tied to AK attribute, seems to be hardcoded, but normal attacks work fine.
      Example: If a ravager has an AK of 0 the player will still receive knockback if they're blocking, and if the value is 5 the knockback wouldn't be any different either.

      3.- Hoglins & Zoglins are exempt from this. Regardless of the AK value, the knockback applied to the shield is proportional, blocking or not. However, it also depends on whether or not the player is touching the ground (if they are, the knockback is massively reduced).
      Example: A zoglin with an AK of 0 will not apply knockback to you, but if it has a value of 5 it'll launch you very high up in the air, blocking or not.

      Expected behavior

      The attack_knockback attribute would act the same way on other mobs as how it works on Hoglins and Zoglins when attacks are blocked, fixing the inconsistency.

      How to reproduce

      There's a lot of steps to demonstrate this, so i'll only focus on the first point. You can take into account all the logic of other points above and test by yourself. Make use of /attribute and /summon.

      1. Summon a husk with an attack_knockback of 5, switch to survival.
        /summon husk ~ ~1 ~ {Attributes:[{Name:"generic.attack_knockback",Base:5f}]}
        
      2. The husk attacks you applying high knockback to you.
      3. If you are blocking with a shield, the husk doesn't apply any knockback.

            Unassigned Unassigned
            Chavamix700 syarumi
            Votes:
            7 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: