global.rumbleTimer = 0;

local MAX_RUMBLE = 0.04
local RUMBLE_SPEED = 25

local blockFeet = P:getBlockBelow(player, -1)
local blockUnder = P:getBlockBelow(player, 0)

local inSnow = blockFeet == "minecraft:powder_snow" or blockFeet == "minecraft:snow"
local onIce = blockUnder == "minecraft:ice" or blockUnder == "minecraft:packed_ice" or blockUnder == "minecraft:blue_ice" or blockUnder == "minecraft:snow_block"

if inSnow or onIce then
    rumbleTimer = rumbleTimer + deltaTime * RUMBLE_SPEED
    local r = math.sin(rumbleTimer) * MAX_RUMBLE

    M:rotateZ(matrices, -r * 10)
    M:moveY(matrices, math.abs(r) * 0.1)
else
    rumbleTimer = 0
end
