
# -> Reset adv trigger
advancement revoke @s only overly_realistic:player/predicate_vars/falling/pred_var_enable

# -> Set value
scoreboard players set @s OverlyRealistic.PredicateValue.IsFalling 1

# -> Add to fall time
execute unless score @s OverlyRealistic.Player.FallTime matches 2147483500.. run \
    scoreboard players add @s OverlyRealistic.Player.FallTime 100

# -> If fall time is not over the minimum needed for the fall sounds then return
execute unless score @s OverlyRealistic.Player.FallTime matches 500.. run \
    return fail

# -> If player has just started to fall then play sound
execute unless score @s OverlyRealistic.Player.FallSoundTime matches -2147483648..2147483647 run \
    playsound minecraft:item.elytra.flying ambient @s ~ ~ ~ 0.2 1

# -> Add to FallSoundTime
scoreboard players add @s OverlyRealistic.Player.FallSoundTime 1

# -> If FallSoundTime isnt over minimum needed for sound-replay then return
execute unless score @s OverlyRealistic.Player.FallSoundTime matches 70.. run \
    return fail

# -> Reset FallSoundTimer loop
scoreboard players set @s OverlyRealistic.Player.FallSoundTime 0

# -> Play sound
playsound minecraft:item.elytra.flying ambient @s ~ ~ ~ 0.3 1
