Carpet

Carpet

2M Downloads

__on_player_takes_damage event uses player data from after taking damage

James103 opened this issue ยท 1 comments

commented

As of Carpet Mod 1.4.0 in Minecraft 1.15.2, if you have an __on_player_takes_damage() event defined and you take damage, it will fetch the player data from after taking damage, not before. This means the following:

  • Querying a player's HP from within the damage event returns the HP after the damage is subtracted instead of before.
  • It is impossible to know a player's health before taking damage without it being tracked somewhere else if the damage event were to put you to 0 HP or below (since your HP would just be floored at 0).

To reproduce, run the following command: /script run __on_player_takes_damage(player, amount, source, source_entity) -> print(player~'health'), then take damage.

commented