scoreboard players remove @s freeze 1

# Freeze
effect give @s slowness 1 10 true

# Fall to ground
execute if entity @s[type=#effects:hard_freeze] if block ~ ~-.05 ~ water run tp @s ~ ~-.05 ~
execute if entity @s[type=#effects:hard_freeze] if block ~ ~-.3 ~ #mrcd:air_like run tp @s ~ ~-.3 ~
execute if entity @s[type=#effects:hard_freeze] unless block ~ ~-.1 ~ water if block ~ ~-.3 ~ #mrcd:player_can_pass run tp @s ~ ~-.3 ~

# Particles
execute unless predicate effects:is_baby run particle item ice ~ ~.7 ~ .2 .7 .2 .0001 2 force
execute unless predicate effects:is_baby run particle falling_dust ice ~ ~.7 ~ .2 .7 .2 0 1 force
execute if predicate effects:is_baby run particle item ice ~ ~.2 ~ .1 .2 .1 .0001 2 force
execute if predicate effects:is_baby run particle falling_dust ice ~ ~.2 ~ .1 .2 .1 .0001 1 force

# Clear
execute if score @s freeze matches 0 run function effects:freeze/clear