Reducing damage of an EntityDamageEvent allows future damage to bypass NoDamageTicks partially #11393
Labels
status: input wanted
Looking for community feedback on this issue.
type: bug
Something doesn't work as it was intended to.
version: 1.21.1
Expected behavior
This issue applies to all damage types, but is specifically more noticeable in damage types that attempt to deal damage each tick (lava, cactus), so i will use lava as an example.
When standing in lava, I expect armor to take damage every 10 ticks as it does in vanilla, regardless of the amount of damage the lava deals.
Observed/Actual behavior
Armor takes damage and lava burn sounds are played every tick.
Steps/models to reproduce
@EventHandler
public void onLava(EntityDamageEvent event) {
if (event.getCause() == EntityDamageEvent.DamageCause.LAVA) {
event.setDamage(event.getDamage() * .99);
}
}
Plugin and Datapack List
Nothing except this listener.
Paper version
This server is running Silvera version 1.21.1-DEV-main@9d0a210 (2024-09-13T02:50:33Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
This is a private fork, but is based off of latest and has no related changes, several other servers have run into this issue, presumably on other forks or standard Paper. I can replicate it on latest if necessary.
Other
This appears to be the source of the issue. d98db39
This is caused by amount being set to a lower value before lastHurt is assigned to this value.
For example, lava deals 4 damage, but if this is reduced to 3 damage, lastHurt will be 3 on the next tick, but amount will be 4, resulting in the if case failing and damage attempting to be dealt.
The text was updated successfully, but these errors were encountered: