local player = context.player
local matrices = context.matrices
local deltaTime = context.deltaTime
local item = context.item

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 mainItem = P:getMainItem(player)
local offItem = P:getOffhandItem(player)

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"
local holdingCold = I:getName(mainItem) == "minecraft:snow_block" or I:getName(offItem) == "minecraft:snow_block" or I:getName(mainItem) == "minecraft:snow" or I:getName(offItem) == "minecraft:snow" or I:getName(mainItem) == "minecraft:ice" or I:getName(offItem) == "minecraft:ice" or I:getName(mainItem) == "minecraft:packed_ice" or I:getName(offItem) == "minecraft:packed_ice" or I:getName(mainItem) == "minecraft:blue_ice" or I:getName(offItem) == "minecraft:blue_ice"

if holdingCold or 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