mojira.dev
MC-260499

Damage rules does not store the correct damage taken

The damage rules does not appear to store the actual value received by the player, but the not clamped value. This is notable when dealing an amount of damage that would otherwise be negative (such as instant damage level 29b)

 

How to Reproduce:

1: In a entity with healt, apply instant damage (via any method) with amplifier equal to 29b with a duration of 1 tick (preferred)

2: Deal any type of common damage to the entity (eg: punch the entity with your hand)

You will notice that after applying the effect, the entity will receive 0 damage and do the damage animation. however, after hitting the entity, you will notice that the entity will take a deadly amount of damage (in my tests, the punch dealt 1.1E9 damage)

 

Remembering that the damage taken during damaged cooldown are the current damage based on the difference between the highest previous damage (within the hurttime duration) and the current damage IF the result of this is greater than 0.

With that said, what is probably happening is that the entity received negative damage, the final damage was clamped and set to 0 but the damage rules stored that negative damage.

 

This can only be caused by a flaw in the damage rules logic, which is not storing the actual final damage. 

 

This bug has been in minecraft for a long time and I think it affects all versions of the game.

Related issues

Comments

migrated

Amplifiers over 4 are not supported. (MC-10755) Additionally, HurtTime stores the invulnerability frames left from after a hit, not the damage taken.

migrated

Note that hurttime are NOT invulnerability frames and not just the frame count. Actually it is a set of rules

It is an extremely common mistake to think that hurttime are iframes, but they are not

EDIT: I used the term hurttime incorrectly when I should have used Damage Rules. The post has been edited to correct this

migrated

HurtTime is a short, set to 10 on hit (same duration as red tint and invulnerability), nothing else. During a lag spike, it is clearly visible it does not control the red tint.

Regardless of any of this, your test case requires an amplifier of 29, while only up to 4 is supported (MC-10755); if you cannot provide a test case without unsupported amplifiers/mecganics, this report is Won't Fix/a duplicate.

migrated

Again, there is no invulnerability. The only invulnerability in minecraft is when you respawn/enter the world. Taking damage does not make you invulnerable, but a different rule of how the damage is received is applied.

Unfortunately the only way to replicate the bug that I could think of is this, but my intention is to report a logic bug that may lead to other problems in the future, not what the effect with a 29b amplifier can do. It's fine if mojang doesn't want to fix it, but at least I did my part

I have also seen a bug about wolves that was related to NBT (which they clearly do not support) get marked as open because it had another indirect problem, so I still have hope

migrated

@Dhranios please also note that I have edited the post a lot since I first submitted it. I don't knkw how but it had been sent before I finished completing

j_p_smith

If you're asking for the HurtTime mechanics to take negative damage amounts into account, then that is a feature request. Negative damage values only exist because of MC-10755, and are therefore not supported.

migrated

(Unassigned)

Unconfirmed

(Unassigned)

1.19.3, 1.19.4 Pre-release 1, 1.19.4 Pre-release 3, 1.19.4, 23w17a, 1.20.1, 23w33a

Retrieved