Scarpet suggestion: Second damage event triggered after damage is applied but before death is checked.
James103 opened this issue ยท 0 comments
Currently (for builds released after June 14, 2020 or commit f871a5d), when you take damage, the __on_player_takes_damage
event gets fired. However, as it currently stands, the value for amount
in __on_player_takes_damage
is the amount of damage that was just dealt to you, before any damage reductions come into play.
While this is useful for things that rely on the amount of damage that you take before reductions (such as "this mob gets stronger the more damage it deals to players", or a custom health/damage system), this behavior is not completely wanted for things such as "if you take 5 damage or more (after all reductions), you lose 5 levels".
If only there was a way for Carpet mod to fire a second damage taken event (such as __on_player_takes_damage_post
for players and after_damaged
for entities) which fetches player/entity data from after the damage is taken and effects are applied but before the entity is supposed to die (if it has 0 health). In this case, the amount
value would be the damage after all damage reductions come into play.
Note that Scarpet apps can use NBT storage or other methods to bring the variables from the first damage event into the second damage event and/or any subsequent code that may follow.