gnembon / scarpet

Public Repository of scarpet programs for Minecraft
Creative Commons Zero v1.0 Universal
358 stars 162 forks source link

carried_totem.sc is not correctly handling the incorrect amount of damage from scarpet API #256

Closed WerLunar closed 2 years ago

WerLunar commented 3 years ago

Describe the bug UPDATE: please see the comment below. carried_totem.sc always calculates the amount of fall damage as the player has no feather falling boot, even when the player is wearing one. It is resulting in one totem loss without animation when the actual damage is not enough for the player to die.

To Reproduce Steps to reproduce the behavior:

  1. Create a flat world.
  2. Build platform 30 blocks above ground.
  3. Equip the player with feather falling 4 boots and give a totem of undying.
  4. Download carried_totem.sc.
  5. Switch to survival and Jump to the ground.

Expected behavior carried_totem.sc should calculate the amount of fall damage after feather falling, which is not going to trigger when falling 30 blocks with feather falling 4 and full health.

Screenshots 2021-10-22_08 53 06 2021-10-22_08 53 16

Environment

WerLunar commented 3 years ago

After several tests I found this issue seems to be caused by __on_player_takes_damage function of scarpet API, which does not seems passing the amount of damage after potential absorbtion was applied, instead it is passing the amount before absorbtion.

I didn't do any intensive tests nor debugged carpet mod. The statement above is merely based on my observation of behaviours of carried_totem.sc under multiple situation, including damage from falling, lava, cactus and zombie. I'm unable to work on scarpet API or carpet mod for now, however I can try to fix this script.

A pull request of my fix should be opened soon, hopefully :)