mojira.dev
MCPE-167651

No knockback or damage immunity when dealing massive damage against someone with a small damage multiplier

Once mobs and players start doing lots of damage against someone with a lower damage multiplier, no knockback is taken. Invulnerability frames do not appear either, as someone doing high enough damage can kill the player in moments.

 

Steps to reproduce:

  1. Add the damage sensor component into the player.json with a tiny damage multiplier, something along the lines of this:

    "minecraft:damage_sensor": {
       "triggers": {
          "cause": "all",
          "damage_multiplier": 0.01
          }
       }
  1. Open a test world and spawn a hostile mob (or invite another player to join), we'll refer to them as Attacker

  2. Use the effect command to grant Attacker a notably high strength level (something like strength 5 should be good enough, although I did this with an enderman, so it may need to be higher for weaker mobs)

  3. Go into survival mode and allow yourself to be hit by Attacker

Expected Results:
You should take a damage tick knockback, regardless if the attack ultimately hurts you or not.

If Attacker is a player, damage immunity frames should also prevent Attacker from rapidly hurting the opponent.

Results shown:
There is no knockback taken. Apparently at some specific level, proper damage application knockback stops being accounted for.

 

Update 1: I have created a new world specifically to show off the bug in great detail (in the attachment below). This world has a behavior pack where the player.json has the damage sensor modified with the damage multiplier. In the case that the bug must be recreated from scratch, however, I have already explained here how to recreate the issue.

Update 2: This also affects the breaking of armor. Going based off of Golden Helmet's comment as of the 12th of March, 2023, receiving fatal damage being calced beforehand also prevents the durability breaking of armor. 

Linked issues

Attachments

Comments 3

Please provide a sample pack to test the issue.

I have now provided not only a sample pack, but a whole sample world so that it would be much more convenient to test the issue.

re: knockback

The knockback cancellation applies only to players. It is result of MCPE-46301 and a false positive for fatal damage from whatever function triggers MCPE-46301. The false positive occurs when the attack damage would be enough to kill the player before applying the damage_multiplier. (This is similar to the false positive described in MCPE-66473, but I cannot reproduce that bug in the current version.) You can see that this is the case with the following steps:

  1. /effect @s health_boost 1000 1 true

  2. /effect @s instant_health 1 1 true

  3. /summon husk ~40 ~ ~

  4. /effect @e strength 1000 5 false

  5. Walk up to the husk and take hits.

These commands give the player 4 extra hearts before initiating the steps in the description with a husk. The the first husk hit gives knockback, but subsequent hits do not give knockback because the player's health has been lowered enough to make the base strength VI husk attack "fatal".

re: damage immunity

The lack of damage immunity has a similar cause to the lack of knockback: the damage immunity calculations take place before the damage_multiplier gets applied. Damage immunity allows additional damage to be added by hits that would do more damage by themselves than the hit that triggered damage immunity. So for example, if you punch for 1 damage and then hit with a diamond sword for 8 damage 1/4 of a second later, the diamond sword will do 7 damage. This mechanic allows the highest-damage hit to determine the total damage during each damage immunity period. As a result of the bug, repeated hits that would cause the same damage are treated by the damage immunity check as if they do more damage than the preceding hits.

The test world from MCPE-168130 helps to demonstrate this. It uses a 0.5 damage_multiplier.

  1. The first hit from a diamond sword does 4 damage.

  2. The second hit is treated by damage immunity as if it were an 8-damage hit. Since only 4 damage has been done so far, damage immunity allows 4 damage. Then the damage_multiplier reduces that to 2.

  3. The third hit is treated by damage immunity as if it were an 8-damage hit. Since only 6 damage has been done so far, damage immunity allows 2 damage. Then the damage_multiplier reduces that to 1.

  4. The fourth hit is treated by damage immunity as if it were an 8-damage hit. Since only 7 damage has been done so far, damage immunity allows 1 damage. At this point it appears that one of two things happens (I can't determine which it is):

  • The damage_multiplier reduces the 1 to 0.5 and then damage immunity disallows adding fractional damage to bring 7.5 closer to 8.

  • The damage_multiplier does not reduce 1 further because it disallows fractional damage.

Daethie

(Unassigned)

986961, 1164191

Confirmed

Multiple

Android 11

1.19.63, 1.19.81 Hotfix, 1.19.83 Hotfix, 1.20.0, 1.20.1 Hotfix, ..., 1.20.31 Hotfix, 1.20.32 Hotfix, 1.20.40, 1.20.41 Hotfix, 1.20.50

1.20.70.21 Preview, 1.20.70

Retrieved