
# -> If block is not water then return
execute unless block ~ ~ ~ water run \
    return run \
        scoreboard players reset @s OverlyRealistic.Player.FallTime

# -> Get entity's attributes
execute store result score #or.safe_fall_distance OverlyRealistic.General.ArbitraryData run \
    attribute @s safe_fall_distance get 10000
execute store result score #or.fall_damage_multiplier OverlyRealistic.General.ArbitraryData run \
    attribute @s fall_damage_multiplier get 10000

# -> Calc first equation part
execute store result score #or.equation_part_1 OverlyRealistic.General.ArbitraryData run \
    scoreboard players get @s OverlyRealistic.Player.FallTime
scoreboard players operation #or.equation_part_1 OverlyRealistic.General.ArbitraryData -= #or.safe_fall_distance OverlyRealistic.General.ArbitraryData

# -> Calc second equation part
scoreboard players operation #or.equation_part_1 OverlyRealistic.General.ArbitraryData *= #or.fall_damage_multiplier OverlyRealistic.General.ArbitraryData
execute store result storage overly_realistic:boats fall_damage float 0.00000001 run \
    scoreboard players get #or.equation_part_1 OverlyRealistic.General.ArbitraryData

# -> Reset value
scoreboard players reset @s OverlyRealistic.Player.FallTime

# -> Apply damage
function overly_realistic:general/boats/boats_damage_entity with storage overly_realistic:boats

