    function easeOutBack(t, back, speed)
    back = back or 1.70158
    speed = speed or 1.0
    t = math.min(math.max(t * speed, 0), 1)
    t = t - 1
    return (t * t * ((back + 1) * t + back) + 1)
end

function easeCustom(t)
    local t2 = t * t
    local t3 = t2 * t
    return 3 * t * (1 - t) * (1 - t) * 0.44 +
        3 * t2 * (1 - t) * 1 +
        t3
end

function easeCustomSec(t)
    local t2 = t * t
    local t3 = t2 * t
    return 3 * t * (1 - t) * (1 - t) * 0.44 +
        3 * t2 * (1 - t) * 0.94 +
        t3
end

global.foodCount = 0.0;
global.foodCountO = 0.0;

global.pitchAngle = 0.0;
global.yawAngle = 0.0;
global.pitchAngleO = 0.0;
global.yawAngleO = 0.0;

local ptAngle = context.ptAngle or 0
local ywAngle = context.ywAngle or 0

local ywAngle = (context.mainHand and yawAngle) or yawAngleO
local ptAngle = (context.mainHand and pitchAngle) or pitchAngleO

local bl = context.bl
local item = context.item
local matrices = context.matrices
local player = context.player
local mainHand = context.mainHand
local deltaTime = context.deltaTime
local mainHandSwingProgress = context.mainHandSwingProgress
local swingMHand = context.swingMHand
local swingOHand = context.swingOHand
local particles = context.particles
local swingProgress = context.swingProgress
local equipProgress = context.equipProgress
local mainHandSwitchEvent = context.mainHandSwitchEvent
local offHandSwitchEvent = context.offHandSwitchEvent
local foodcount = Easings:easeInQuart(context.mainHand and foodCount or foodCountO)

local ptAngle = context.ptAngle or 0
local ywAngle = context.ywAngle or 0

local ywAngle = (context.mainHand and yawAngle) or yawAngleO
local ptAngle = (context.mainHand and pitchAngle) or pitchAngleO
local hand = context.hand
local age = P:getAge(context.player)
local crackleTick = M:floor(age / 3)
local l = (bl and 1) or -1

local function noBlocksPlease(list)
    for _, entry in ipairs(list) do
        local id, asBlock

        if type(entry) == "string" then
            id = entry
            asBlock = false

        elseif type(entry) == "table" then
            id = entry[1]
            asBlock = entry[2]
        end

        renderAsBlock:put(id, asBlock)
    end
end

noBlocksPlease({
    "minecraft:firefly_bush",
    "minecraft:wither_rose",
    "minecraft:open_eyeblossom",
    "minecraft:closed_eyeblossom",
    "minecraft:cactus_flower",
    "minecraft:torchflower",
    "minecraft:lily_of_the_valley",
    "minecraft:cornflower",
    "minecraft:oxeye_daisy",
    "minecraft:white_tulip",
    "minecraft:pink_tulip",
    "minecraft:red_tulip",
    "minecraft:orange_tulip",
    "minecraft:azure_bluet",
    "minecraft:allium",
    "minecraft:blue_orchid",
    "minecraft:poppy",
    "minecraft:dandelion",
    "minecraft:dead_bush",
    "minecraft:bush",
    "minecraft:short_dry_grass",
    "minecraft:tall_dry_grass",
    "minecraft:crimson_fungus",
    "minecraft:warped_fungus",
    "minecraft:short_grass",
    "minecraft:tall_grass",
    "minecraft:sugar_cane",
    "minecraft:fern",
    "minecraft:large_fern",
    "minecraft:pale_hanging_moss",
    "minecraft:hanging_roots",
    "minecraft:cherry_sapling",
    "minecraft:oak_sapling",
    "minecraft:spruce_sapling",
    "minecraft:birch_sapling",
    "minecraft:acacia_sapling",
    "minecraft:dark_oak_sapling",
    "minecraft:pale_oak_sapling",
    "minecraft:jungle_sapling",
    "minecraft:mangrove_propagule",
    "minecraft:pitcher_plant",
    "minecraft:peony",
    "minecraft:rose_bush",
    "minecraft:lilac",
    "minecraft:brown_mushroom",
    "minecraft:red_mushroom",
    "minecraft:crimson_roots",
    "minecraft:warped_roots",
    "minecraft:nether_sprouts",
    "minecraft:sunflower",
    "minecraft:bell",
    "minecraft:pointed_dripstone",
    "minecraft:amethyst_cluster",
    "minecraft:large_amethyst_bud",
    "minecraft:medium_amethyst_bud",
    "minecraft:small_amethyst_bud",
    "minecraft:cocoa_beans",
    "minecraft:pumpkin_seeds",
    "minecraft:melon_seeds",
    "minecraft:beetroot_seeds",
    "minecraft:turtle_egg",
    "minecraft:nether_wart",
    "minecraft:tube_coral",
    "minecraft:bubble_coral_fan",
    "minecraft:fire_coral_fan",
    "minecraft:tube_coral_fan",
    "minecraft:horn_coral_fan",
    "minecraft:brain_coral_fan",
    "minecraft:fire_coral",
    "minecraft:horn_coral",
    "minecraft:brain_coral",
    "minecraft:bubble_coral",
    "minecraft:dead_tube_coral",
    "minecraft:dead_fire_coral",
    "minecraft:dead_horn_coral",
    "minecraft:dead_brain_coral",
    "minecraft:dead_bubble_coral",
    "minecraft:dead_bubble_coral_fan",
    "minecraft:dead_fire_coral_fan",
    "minecraft:dead_tube_coral_fan",
    "minecraft:dead_horn_coral_fan",
    "minecraft:dead_brain_coral_fan",
    "minecraft:lever",
    "minecraft:redstone_torch",
    "minecraft:big_dripleaf",
    "minecraft:white_bed",
    "minecraft:black_bed",
    "minecraft:pink_bed",
    "minecraft:light_blue_bed",
    "minecraft:purple_bed",
    "minecraft:magenta_bed",
    "minecraft:turtle_helmet",
    "minecraft:blue_bed",
    "minecraft:green_bed",
    "minecraft:orange_bed",
    "minecraft:cyan_bed",
    "minecraft:lime_bed",
    "minecraft:brown_bed",
    "minecraft:gray_bed",
    "minecraft:light_gray_bed",
    "minecraft:red_bed",
    "minecraft:yellow_bed",
    "minecraft:cobweb",
    "minecraft:flower_pot",
    "minecraft:oak_door",
    "minecraft:spruce_door",
    "minecraft:birch_door",
    "minecraft:jungle_door",
    "minecraft:acacia_door",
    "minecraft:crimson_door",
    "minecraft:mangrove_door",
    "minecraft:cherry_door",
    "minecraft:pale_oak_door",
    "minecraft:warped_door",
    "minecraft:bamboo_door",
    "minecraft:dark_oak_door",
    "minecraft:iron_door",
    "minecraft:copper_door",
    "minecraft:exposed_copper_door",
    "minecraft:weathered_copper_door",
    "minecraft:oxidized_copper_door",
    "minecraft:waxed_copper_door",
    "minecraft:waxed_exposed_copper_door",
    "minecraft:waxed_weathered_copper_door",
    "minecraft:waxed_oxidized_copper_door",
    "minecraft:copper_bars",
    "minecraft:exposed_copper_bars",
    "minecraft:weathered_copper_bars",
    "minecraft:oxidized_copper_bars",
    "minecraft:waxed_copper_bars",
    "minecraft:waxed_exposed_copper_bars",
    "minecraft:waxed_weathered_copper_bars",
    "minecraft:waxed_oxidized_copper_bars",
    "minecraft:iron_chain",
    "minecraft:copper_chain",
    "minecraft:exposed_copper_chain",
    "minecraft:weathered_copper_chain",
    "minecraft:oxidized_copper_chain",
    "minecraft:waxed_copper_chain",
    "minecraft:waxed_oxidized_copper_chain",
    "minecraft:waxed_exposed_copper_chain",
    "minecraft:waxed_weathered_copper_chain",
    {"minecraft:torch", not ${torchsAndLanterns}},
    {"minecraft:soul_torch", not ${torchsAndLanterns}},
    {"minecraft:copper_torch", not ${torchsAndLanterns}},
    {"minecraft:lantern", not ${torchsAndLanterns}},
    {"minecraft:soul_lantern", not ${torchsAndLanterns}},
    {"minecraft:weathered_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:exposed_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:oxidized_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:waxed_weathered_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:waxed_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:waxed_exposed_copper_lantern", not ${torchsAndLanterns}},
    {"minecraft:waxed_oxidized_copper_lantern", not ${torchsAndLanterns}},
    "minecraft:pitcher_pod",
    "minecraft:lightning_rod",
    "minecraft:exposed_lightning_rod",
    "minecraft:weathered_lightning_rod",
    "minecraft:oxidized_lightning_rod",
    "minecraft:waxed_lightning_rod",
    "minecraft:waxed_exposed_lightning_rod",
    "minecraft:waxed_weathered_lightning_rod",
    "minecraft:waxed_oxidized_lightning_rod",
    "minecraft:bowl",
    "minecraft:lily_pad",
    "minecraft:sea_pickle",
    "minecraft:end_rod",
    "minecraft:oak_hanging_sign",
    "minecraft:spruce_hanging_sign",
    "minecraft:birch_hanging_sign",
    "minecraft:jungle_hanging_sign",
    "minecraft:acacia_hanging_sign",
    "minecraft:dark_oak_hanging_sign",
    "minecraft:mangrove_hanging_sign",
    "minecraft:cherry_hanging_sign",
    "minecraft:pale_oak_hanging_sign",
    "minecraft:bamboo_hanging_sign",
    "minecraft:crimson_hanging_sign",
    "minecraft:warped_hanging_sign",
})

--Tools

if I:isIn(context.item, Tags:getVanillaTag("spears")) and ${tools} then
    M:moveZ(matrices, 0.095)
    M:rotateX(matrices, 3)
    M:rotateY(matrices, 12.5)
    M:rotateZ(matrices, 6.5)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("pickaxes")) and ${tools} then
    M:scale(matrices, 0.9, 0.9, 0.9)
    M:moveX(matrices, 0.030)
    M:moveY(matrices, 0)
    M:moveZ(matrices, -0.030)
    M:rotateX(matrices, -11.5)
    M:rotateY(matrices, -3)
    M:rotateZ(matrices, 4)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("pickaxes")) and ${tools} then
    M:moveY(matrices, 0)
    M:moveZ(matrices, -0.030)
    M:rotateX(matrices, -11.5)
    M:rotateZ(matrices, -3.5)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("axes")) and ${tools} then
    M:moveX(matrices, 0.005)
    M:moveY(matrices, -0.005)
    M:moveZ(matrices, -0.050)
    M:rotateX(matrices, -10.5)
    M:rotateY(matrices, -3.5)
    M:rotateZ(matrices, 6)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("axes")) and ${tools} then
    M:moveX(matrices, -0.020)
    M:moveY(matrices, -0.005)
    M:moveZ(matrices, -0.050)
    M:rotateX(matrices, -10.5)
    M:rotateY(matrices, -3.5)
    M:rotateZ(matrices, 0)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("shovels")) and ${tools} then
    M:scale(matrices, 0.9, 0.9, 0.9)
    M:moveX(matrices, 0.015)
    M:moveY(matrices, 0.135)
    M:moveZ(matrices, 0.125)
    M:rotateX(matrices, -14)
    M:rotateY(matrices, -89.5)
    M:rotateZ(matrices, -5)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("hoes")) and ${tools} then
    M:moveX(matrices, 0)
    M:moveY(matrices, 0.015)
    M:moveZ(matrices, 0.005)
    M:rotateX(matrices, -7)
    M:rotateY(matrices, -6)
    M:rotateZ(matrices, 6.5)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("swords")) and ${tools} then
    M:scale(matrices, 0.9, 0.9, 0.9)
    M:moveX(matrices, -0.005)
    M:rotateX(matrices, -8.5)
    M:rotateY(matrices, -7)
    M:rotateZ(matrices, 6)
end

--Signs

if mainHand and I:isIn(context.item, Tags:getVanillaTag("hanging_signs")) then
    M:moveX(matrices, 0.020)
    M:moveY(matrices, 0.56)
    M:moveZ(matrices, 0.17)
    M:rotateX(matrices, -123)
    M:rotateZ(matrices, 176)
    M:scale(matrices, 1.1, 1.1, 1.1)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("hanging_signs")) then
    M:moveX(matrices, -0.020)
    M:moveY(matrices, 0.56)
    M:moveZ(matrices, 0.17)
    M:rotateX(matrices, -123)
    M:rotateZ(matrices, -176)
    M:scale(matrices, 1.1, 1.1, 1.1)
end


if mainHand and I:isIn(context.item, Tags:getVanillaTag("signs")) then
    M:moveX(matrices, 0.065)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("signs")) then
    M:moveX(matrices, -0.065)
end


--Music Discs

if (
        I:isOf(item, Items:get("minecraft:music_disc_5")) or
        I:isOf(item, Items:get("minecraft:music_disc_11")) or
        I:isOf(item, Items:get("minecraft:music_disc_13")) or
        I:isOf(item, Items:get("minecraft:music_disc_blocks")) or
        I:isOf(item, Items:get("minecraft:music_disc_cat")) or
        I:isOf(item, Items:get("minecraft:music_disc_chirp")) or
        I:isOf(item, Items:get("minecraft:music_disc_creator")) or
        I:isOf(item, Items:get("minecraft:music_disc_creator_music_box")) or
        I:isOf(item, Items:get("minecraft:music_disc_far")) or
        I:isOf(item, Items:get("minecraft:music_disc_lava_chicken")) or
        I:isOf(item, Items:get("minecraft:music_disc_mall")) or
        I:isOf(item, Items:get("minecraft:music_disc_mellohi")) or
        I:isOf(item, Items:get("minecraft:music_disc_otherside")) or
        I:isOf(item, Items:get("minecraft:music_disc_pigstep")) or
        I:isOf(item, Items:get("minecraft:music_disc_precipice")) or
        I:isOf(item, Items:get("minecraft:music_disc_relic")) or
        I:isOf(item, Items:get("minecraft:music_disc_stal")) or
        I:isOf(item, Items:get("minecraft:music_disc_strad")) or
        I:isOf(item, Items:get("minecraft:music_disc_tears")) or
        I:isOf(item, Items:get("minecraft:music_disc_wait")) or
        I:isOf(item, Items:get("minecraft:music_disc_ward"))
    ) then
    M:scale(matrices, 0.95, 0.95, 0.95)
        M:moveY(matrices, -0.010)
end


--Building Blocks

if mainHand and I:isIn(context.item, Tags:getVanillaTag("doors")) then
    M:moveX(matrices, -0.2)
    M:moveZ(matrices, 0.4)
    M:moveY(matrices, 0.3)
    M:rotateZ(matrices, 0)
    M:rotateY(matrices, -100)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("doors")) then
    M:moveX(matrices, 0.2)
    M:moveZ(matrices, 0.4)
    M:moveY(matrices, 0.4)
    M:rotateZ(matrices, 0)
    M:rotateY(matrices, -80)
end

if I:isIn(context.item, Tags:getVanillaTag("trapdoors")) then
    M:moveY(matrices, 0.1)
end

if mainHand and I:isIn(context.item, Tags:getVanillaTag("fence_gates")) then
    M:moveX(matrices, -0.300)
    M:moveY(matrices, -0.075)
    M:moveZ(matrices, -0.045)
    M:rotateY(matrices, 85)
    M:scale(matrices, 1.3, 1.3, 1.3)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("fence_gates")) then
    M:moveX(matrices, 0.365)
    M:moveY(matrices, -0.065)
    M:moveZ(matrices, 0.050)
    M:rotateY(matrices, 101)
    M:scale(matrices, 1.3, 1.3, 1.3)
end


if I:isIn(context.item, Tags:getVanillaTag("buttons")) then
    M:moveY(matrices, 0.1)
    M:scale(matrices, 1.63, 1.63, 1.63)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:oak_shelf")) or
        I:isOf(item, Items:get("minecraft:spruce_shelf")) or
        I:isOf(item, Items:get("minecraft:birch_shelf")) or
        I:isOf(item, Items:get("minecraft:jungle_shelf")) or
        I:isOf(item, Items:get("minecraft:acacia_shelf")) or
        I:isOf(item, Items:get("minecraft:dark_oak_shelf")) or
        I:isOf(item, Items:get("minecraft:mangrove_shelf")) or
        I:isOf(item, Items:get("minecraft:cherry_shelf")) or
        I:isOf(item, Items:get("minecraft:pale_oak_shelf")) or
        I:isOf(item, Items:get("minecraft:bamboo_shelf")) or
        I:isOf(item, Items:get("minecraft:crimson_shelf")) or
        I:isOf(item, Items:get("minecraft:warped_shelf"))
    ) then
    M:moveX(matrices, -0.4)
    M:moveY(matrices, 0.090)
    M:moveZ(matrices, 0.120)
    M:rotateX(matrices, 1.5)
    M:rotateY(matrices, 114)
    M:scale(matrices, 1.1, 1.1, 1.1)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:oak_shelf")) or
        I:isOf(item, Items:get("minecraft:spruce_shelf")) or
        I:isOf(item, Items:get("minecraft:birch_shelf")) or
        I:isOf(item, Items:get("minecraft:jungle_shelf")) or
        I:isOf(item, Items:get("minecraft:acacia_shelf")) or
        I:isOf(item, Items:get("minecraft:dark_oak_shelf")) or
        I:isOf(item, Items:get("minecraft:mangrove_shelf")) or
        I:isOf(item, Items:get("minecraft:cherry_shelf")) or
        I:isOf(item, Items:get("minecraft:pale_oak_shelf")) or
        I:isOf(item, Items:get("minecraft:bamboo_shelf")) or
        I:isOf(item, Items:get("minecraft:crimson_shelf")) or
        I:isOf(item, Items:get("minecraft:warped_shelf"))
    ) then
    M:moveX(matrices, 0.4)
    M:moveY(matrices, 0.090)
    M:moveZ(matrices, 0.120)
    M:rotateX(matrices, -1.5)
    M:rotateY(matrices, -114)
    M:scale(matrices, 1.1, 1.1, 1.1)
end

if (
        I:isOf(item, Items:get("minecraft:white_carpet")) or
        I:isOf(item, Items:get("minecraft:orange_carpet")) or
        I:isOf(item, Items:get("minecraft:magenta_carpet")) or
        I:isOf(item, Items:get("minecraft:light_blue_carpet")) or
        I:isOf(item, Items:get("minecraft:yellow_carpet")) or
        I:isOf(item, Items:get("minecraft:lime_carpet")) or
        I:isOf(item, Items:get("minecraft:pink_carpet")) or
        I:isOf(item, Items:get("minecraft:gray_carpet")) or
        I:isOf(item, Items:get("minecraft:light_gray_carpet")) or
        I:isOf(item, Items:get("minecraft:cyan_carpet")) or
        I:isOf(item, Items:get("minecraft:purple_carpet")) or
        I:isOf(item, Items:get("minecraft:blue_carpet")) or
        I:isOf(item, Items:get("minecraft:brown_carpet")) or
        I:isOf(item, Items:get("minecraft:green_carpet")) or
        I:isOf(item, Items:get("minecraft:red_carpet")) or
        I:isOf(item, Items:get("minecraft:black_carpet")) or
        I:isOf(item, Items:get("minecraft:moss_carpet")) or
        I:isOf(item, Items:get("minecraft:pale_moss_carpet"))
    ) then
    M:moveY(matrices, 0.1)
end
if (
        I:isOf(item, Items:get("minecraft:oak_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:spruce_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:birch_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:jungle_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:acacia_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:dark_oak_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:mangrove_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:cherry_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:bamboo_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:crimson_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:warped_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:pale_oak_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:stone_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:polished_blackstone_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:light_weighted_pressure_plate")) or
        I:isOf(item, Items:get("minecraft:heavy_weighted_pressure_plate"))
    ) then
    M:moveY(matrices, 0.1)
end


--Dyes

if mainHand and (I:isOf(item, Items:get("minecraft:white_dye")) or I:isOf(item, Items:get("minecraft:orange_dye")) or I:isOf(item, Items:get("minecraft:magenta_dye")) or I:isOf(item, Items:get("minecraft:light_blue_dye")) or I:isOf(item, Items:get("minecraft:yellow_dye")) or I:isOf(item, Items:get("minecraft:lime_dye")) or I:isOf(item, Items:get("minecraft:pink_dye")) or I:isOf(item, Items:get("minecraft:gray_dye")) or I:isOf(item, Items:get("minecraft:light_gray_dye")) or I:isOf(item, Items:get("minecraft:cyan_dye")) or I:isOf(item, Items:get("minecraft:purple_dye")) or I:isOf(item, Items:get("minecraft:blue_dye")) or I:isOf(item, Items:get("minecraft:brown_dye")) or I:isOf(item, Items:get("minecraft:green_dye")) or I:isOf(item, Items:get("minecraft:red_dye")) or I:isOf(item, Items:get("minecraft:black_dye"))) then
    M:moveZ(matrices, -0.1)
    M:moveX(matrices, 0)
    M:moveY(matrices, -0.2)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, -1)
    M:scale(matrices, 1.4, 1.4, 1.4)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -10, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if not mainHand and (I:isOf(item, Items:get("minecraft:white_dye")) or I:isOf(item, Items:get("minecraft:orange_dye")) or I:isOf(item, Items:get("minecraft:magenta_dye")) or I:isOf(item, Items:get("minecraft:light_blue_dye")) or I:isOf(item, Items:get("minecraft:yellow_dye")) or I:isOf(item, Items:get("minecraft:lime_dye")) or I:isOf(item, Items:get("minecraft:pink_dye")) or I:isOf(item, Items:get("minecraft:gray_dye")) or I:isOf(item, Items:get("minecraft:light_gray_dye")) or I:isOf(item, Items:get("minecraft:cyan_dye")) or I:isOf(item, Items:get("minecraft:purple_dye")) or I:isOf(item, Items:get("minecraft:blue_dye")) or I:isOf(item, Items:get("minecraft:brown_dye")) or I:isOf(item, Items:get("minecraft:green_dye")) or I:isOf(item, Items:get("minecraft:red_dye")) or I:isOf(item, Items:get("minecraft:black_dye"))) then
    M:moveZ(matrices, -0.1)
    M:moveX(matrices, 0)
    M:moveY(matrices, -0.2)
    M:moveX(matrices, -0.05)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, 2)
    M:rotateZ(matrices, -10)
    M:scale(matrices, 1.5, 1.5, 1.5)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -10, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end


--Seeds

if mainHand and (I:isOf(item, Items:get("minecraft:cocoa_beans")) or (I:isOf(item, Items:get("minecraft:pumpkin_seeds")) or I:isOf(item, Items:get("minecraft:melon_seeds")) or I:isOf(item, Items:get("minecraft:beetroot_seeds")))) then
    M:moveZ(matrices, -0.05)
    M:moveX(matrices, -0.05)
    M:moveY(matrices, -0.15)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, -5)
    M:rotateZ(matrices, -10)
    M:scale(matrices, 1.4, 1.4, 1.4)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, 0, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if not mainHand and (I:isOf(item, Items:get("minecraft:cocoa_beans")) or (I:isOf(item, Items:get("minecraft:pumpkin_seeds")) or I:isOf(item, Items:get("minecraft:melon_seeds")) or I:isOf(item, Items:get("minecraft:beetroot_seeds")))) then
    M:moveZ(matrices, -0.05)
    M:moveY(matrices, -0.15)
    M:moveX(matrices, 0.03)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, 8)
    M:rotateZ(matrices, 0)
    M:scale(matrices, 1.5, 1.5, 1.5)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, 0, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if mainHand and (I:isOf(item, Items:get("minecraft:wheat_seeds")) or I:isOf(item, Items:get("minecraft:torchflower_seeds"))) then
    M:moveZ(matrices, -0.02)
    M:moveY(matrices, -0.02)
    M:moveX(matrices, -0.05)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, 5)
    M:rotateZ(matrices, -37)
    M:scale(matrices, 1.25, 1.25, 1.25)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, 10, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if not mainHand and (I:isOf(item, Items:get("minecraft:wheat_seeds")) or I:isOf(item, Items:get("minecraft:torchflower_seeds"))) then
    M:moveZ(matrices, 0)
    M:moveY(matrices, -0.02)
    M:moveX(matrices, 0.05)
    M:rotateX(matrices, -100)
    M:rotateY(matrices, -3)
    M:rotateZ(matrices, 25)
    M:scale(matrices, 1.25, 1.25, 1.25)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, 7, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end


--Others

if mainHand and I:isIn(context.item, Tags:getVanillaTag("harnesses")) then
    M:moveX(matrices, 0.070)
end

if not mainHand and I:isIn(context.item, Tags:getVanillaTag("harnesses")) then
    M:moveX(matrices, -0.070)
end

if mainHand and I:isOf(item, Items:get("minecraft:saddle")) then
    M:moveX(matrices, 0.105)
end

if not mainHand and I:isOf(item, Items:get("minecraft:saddle")) then
    M:moveX(matrices, -0.150)
end

if mainHand and I:isOf(item, Items:get("minecraft:bowl")) then
    M:moveY(matrices, 0.04)
    M:moveX(matrices, -0.05 * l)
    M:moveZ(matrices, 0.2)
    M:rotateX(matrices, -97.5)
    M:scale(matrices, 1.25, 1.25, 1.25)
end

if not mainHand and I:isOf(item, Items:get("minecraft:bowl")) then
    M:moveY(matrices, 0.04)
    M:moveX(matrices, -0.05 * l)
    M:moveZ(matrices, 0.2)
    M:rotateX(matrices, -97.5)
    M:scale(matrices, 1.25, 1.25, 1.25)
end

if mainHand and I:isOf(item, Items:get("minecraft:wheat")) then
    M:moveX(matrices, -0.05)
end

if not mainHand and I:isOf(item, Items:get("minecraft:wheat")) then
    M:moveX(matrices, 0.05)
end

if mainHand and I:isOf(item, Items:get("minecraft:trident")) then
    M:moveY(matrices, -0.05)
    M:moveZ(matrices, 0.1)
    M:moveX(matrices, -0.2)
    M:rotateX(matrices, -10)
    M:rotateZ(matrices, 5)
    M:rotateY(matrices, 40)
end

if not mainHand and I:isOf(item, Items:get("minecraft:trident")) then
    M:moveY(matrices, -0.05)
    M:moveZ(matrices, 0.17)
    M:moveX(matrices, 0.2)
    M:rotateX(matrices, -10)
    M:rotateZ(matrices, -5)
    M:rotateY(matrices, -40)
end


if I:isOf(item, Items:get("minecraft:fishing_rod")) then
    M:rotateX(matrices, -60)
    M:moveY(matrices, -0.2)
end

if I:isOf(item, Items:get("minecraft:warped_fungus_on_a_stick")) or I:isOf(item, Items:get("minecraft:carrot_on_a_stick")) then
    M:rotateX(matrices, -50)
    M:moveY(matrices, -0.2)
    M:moveX(matrices, 0.05)
    M:rotateZ(matrices, 5)
    M:rotateY(matrices, 10)
end

if mainHand and I:isIn(item, Tags:getVanillaTag("beds")) then
    M:moveY(matrices, 0.0)
    M:moveX(matrices, -0.26)
    M:moveZ(matrices, 0.33)
    M:rotateX(matrices, 9)
    M:rotateY(matrices, -185)
    M:rotateZ(matrices, 7)
    M:scale(matrices, 1.9, 1.9, 1.9)
end

if not mainHand and I:isIn(item, Tags:getVanillaTag("beds")) then
    M:moveY(matrices, 0.07)
    M:moveX(matrices, 0.18)
    M:moveZ(matrices, 0.34)
    M:rotateX(matrices, 5.5)
    M:rotateY(matrices, -187.5)
    M:rotateZ(matrices, -7.5)
    M:scale(matrices, 1.8, 1.8, 1.8)
end

if (
        I:isOf(item, Items:get("minecraft:sentry_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:dune_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:coast_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:wild_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:ward_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:eye_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:vex_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:tide_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:snout_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:rib_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:spire_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:wayfinder_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:shaper_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:silence_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:raiser_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:host_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:flow_armor_trim_smithing_template")) or
        I:isOf(item, Items:get("minecraft:netherite_upgrade_smithing_template")) or
        I:isOf(item, Items:get("minecraft:bolt_armor_trim_smithing_template"))
    ) then
            M:scale(matrices, 1.2, 1.2, 1.2)
end

if mainHand and I:isIn(item, Tags:getVanillaTag("lanterns")) and ${torchsAndLanterns} then
    M:moveY(matrices, 0.41)
    M:moveX(matrices, 0.03)
    M:moveZ(matrices, -0.02)
    M:rotateX(matrices, -67)
    M:rotateZ(matrices, -10)
    M:rotateY(matrices, -10)
end

if not mainHand and I:isIn(item, Tags:getVanillaTag("lanterns")) and ${torchsAndLanterns} then
    M:moveY(matrices, 0.45)
    M:moveX(matrices, 0.02)
    M:moveZ(matrices, -0.02)
    M:rotateX(matrices, -67)
    M:rotateZ(matrices, -5)
    M:rotateY(matrices, -2)
end

if I:isOf(item, Items:get("minecraft:leaf_litter")) or I:isOf(item, Items:get("minecraft:pink_petals")) or I:isOf(item, Items:get("minecraft:wildflowers")) then
    M:rotateX(matrices, -5)
end

if I:isOf(item, Items:get("minecraft:flower_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:creeper_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:skull_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:mojang_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:globe_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:snout_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:flow_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:guster_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:field_masoned_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:bordure_indented_banner_pattern"))
    or I:isOf(item, Items:get("minecraft:piglin_banner_pattern")) then
    M:moveY(matrices, -0.2)
    M:moveZ(matrices, 0)
    M:rotateX(matrices, -75)
end

if I:isOf(item, Items:get("minecraft:name_tag")) then
    M:moveY(matrices, -0.21)
    M:rotateX(matrices, -80)
end

if I:isOf(item, Items:get("minecraft:painting")) and mainHand then
    M:moveY(matrices, 0.4)
    M:moveZ(matrices, 0)
    M:moveX(matrices, 0.17)
    M:rotateX(matrices, -67)
    M:rotateZ(matrices, -3)
end

if I:isOf(item, Items:get("minecraft:painting")) and not mainHand then
    M:moveY(matrices, 0.43)
    M:moveZ(matrices, 0)
    M:moveX(matrices, -0.17)
    M:rotateX(matrices, -67)
    M:rotateZ(matrices, -3)
    M:rotateY(matrices, -3)
end

if I:isIn(item, Tags:getVanillaTag("chains")) then
    M:moveY(matrices, -0.2)
    M:moveZ(matrices, 0)
    M:rotateX(matrices, -90)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -30, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if I:isOf(item, Items:get("minecraft:bell")) and mainHand then
    M:moveY(matrices, 0.3)
    M:moveZ(matrices, -0.05)
    M:moveX(matrices, -0.05)
    M:rotateX(matrices, -90)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -35, 60) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if I:isOf(item, Items:get("minecraft:bell")) and not mainHand then
    M:moveY(matrices, 0.3)
    M:moveZ(matrices, -0.05)
    M:moveX(matrices, 0)
    M:rotateX(matrices, -75)
    M:rotateZ(matrices, -3)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -45, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if I:isOf(item, Items:get("minecraft:item_frame")) and mainHand then
    M:moveY(matrices, 0.4)
    M:moveZ(matrices, 0)
    M:moveX(matrices, 0.1)
    M:rotateX(matrices, -68)
    M:rotateZ(matrices, -3)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 2.5, -10, 80) + ptAngle + ywAngle * 0.5, 0, -0.13, 0)
end

if I:isOf(item, Items:get("minecraft:item_frame")) and not mainHand then
    M:moveY(matrices, 0.4)
    M:moveZ(matrices, 0)
    M:moveX(matrices, -0.2)
    M:rotateX(matrices, -68)
    M:rotateZ(matrices, -3)
end

if I:isOf(item, Items:get("minecraft:glow_item_frame")) and mainHand then
    M:moveY(matrices, -0.25)
    M:moveZ(matrices, 0)
    M:moveX(matrices, 0.05)
    M:rotateX(matrices, -95)
    M:rotateZ(matrices, 5)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 2.5, -30, 90) + ptAngle + ywAngle * 0.5, 0, -0.13, 0)
end

if I:isOf(item, Items:get("minecraft:glow_item_frame")) and not mainHand then
    M:moveY(matrices, -0.25)
    M:moveZ(matrices, 0)
    M:moveX(matrices, -0.1)
    M:rotateX(matrices, -95)
    M:rotateZ(matrices, -5)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 2.5, -30, 90) + ptAngle + ywAngle * 0.5, 0, -0.13, 0)
end

if mainHand and I:isOf(item, Items:get("minecraft:lily_pad")) then
    M:moveY(matrices, 0.035)
    M:rotateZ(matrices, 6)
end

if not mainHand and I:isOf(item, Items:get("minecraft:lily_pad")) then
    M:moveY(matrices, 0.035)
    M:rotateZ(matrices, -6)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:vine"))
        or I:isOf(item, Items:get("minecraft:twisting_vines"))
        or I:isOf(item, Items:get("minecraft:weeping_vines"))
        or I:isOf(item, Items:get("minecraft:pale_hanging_moss"))
        or I:isOf(item, Items:get("minecraft:hanging_roots"))
        or I:isOf(item, Items:get("minecraft:cave_vines"))) then
    M:moveY(matrices, -0.2)
    M:moveZ(matrices, -0.03)
    M:moveX(matrices, 0.07)
    M:rotateX(matrices, -75)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -45, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:vine"))
        or I:isOf(item, Items:get("minecraft:twisting_vines"))
        or I:isOf(item, Items:get("minecraft:weeping_vines"))
        or I:isOf(item, Items:get("minecraft:pale_hanging_moss"))
        or I:isOf(item, Items:get("minecraft:hanging_roots"))
        or I:isOf(item, Items:get("minecraft:cave_vines"))) then
    M:moveY(matrices, -0.2)
    M:moveZ(matrices, -0.09)
    M:moveX(matrices, -0.07)
    M:rotateX(matrices, -75)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -45, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end


if mainHand and I:isOf(item, Items:get("minecraft:glow_lichen")) then
    M:rotateX(matrices, -75)
    M:moveZ(matrices, -0.03)
    M:moveX(matrices, 0.1)
    M:rotateZ(matrices, -30)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -45, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if not mainHand and I:isOf(item, Items:get("minecraft:glow_lichen")) then
    M:rotateX(matrices, -75)
    M:moveZ(matrices, -0.03)
    M:moveX(matrices, -0.1)
    M:rotateZ(matrices, 30)
    M:rotateX(matrices, M:clamp(P:getPitch(player) / 1, -45, 90) + ptAngle + ywAngle * 1, 0, -0.05, 0)
end

if mainHand and I:isOf(item, Items:get("minecraft:flint_and_steel")) then
    M:moveX(matrices, -0.050)
    M:moveY(matrices, 0.130)
    M:moveZ(matrices, -0.070)
    M:rotateX(matrices, -10)
    M:rotateY(matrices, -8)
    M:rotateZ(matrices, 4.5)
    M:scale(matrices, 1.1, 1.1, 1.1)
end

if not mainHand and I:isOf(item, Items:get("minecraft:flint_and_steel")) then
    M:moveX(matrices, 0.050)
    M:moveY(matrices, 0.130)
    M:moveZ(matrices, -0.070)
    M:rotateX(matrices, -10)
    M:rotateY(matrices, 8)
    M:rotateZ(matrices, -4.5)
    M:scale(matrices, 1.1, 1.1, 1.1)
end

if mainHand and I:isOf(item, Items:get("minecraft:totem_of_undying")) and ${TotemOfUndying} then
    M:scale(matrices, 1.15, 1.15, 1.15)
    M:moveX(matrices, 0.07)
    M:rotateX(matrices, -110)
    M:rotateZ(matrices, -210)
    M:rotateY(matrices, -5)
end

if not mainHand and I:isOf(item, Items:get("minecraft:totem_of_undying")) and ${TotemOfUndying} then
    M:scale(matrices, 1.1, 1.1, 1.1)
    M:moveX(matrices, -0.020)
    M:moveZ(matrices, 0.11)
    M:rotateX(matrices, -112.5)
    M:rotateZ(matrices, -149)
    M:rotateY(matrices, 6)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:fire_coral")) or
        I:isOf(item, Items:get("minecraft:brain_coral")) or
        I:isOf(item, Items:get("minecraft:bubble_coral")) or
        I:isOf(item, Items:get("minecraft:horn_coral")) or
        I:isOf(item, Items:get("minecraft:tube_coral")) or

        I:isOf(item, Items:get("minecraft:dead_fire_coral")) or
        I:isOf(item, Items:get("minecraft:dead_brain_coral")) or
        I:isOf(item, Items:get("minecraft:dead_bubble_coral")) or
        I:isOf(item, Items:get("minecraft:dead_horn_coral")) or
        I:isOf(item, Items:get("minecraft:dead_tube_coral")) or


        I:isOf(item, Items:get("minecraft:fire_coral_fan")) or
        I:isOf(item, Items:get("minecraft:brain_coral_fan")) or
        I:isOf(item, Items:get("minecraft:bubble_coral_fan")) or
        I:isOf(item, Items:get("minecraft:horn_coral_fan")) or
        I:isOf(item, Items:get("minecraft:tube_coral_fan")) or

        I:isOf(item, Items:get("minecraft:dead_fire_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_brain_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_bubble_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_horn_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_tube_coral_fan"))
    ) then
    M:moveY(matrices, 0.03)
    M:rotateZ(matrices, 8)
    M:rotateY(matrices, -4)
    M:rotateX(matrices, -5)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:fire_coral")) or
        I:isOf(item, Items:get("minecraft:brain_coral")) or
        I:isOf(item, Items:get("minecraft:bubble_coral")) or
        I:isOf(item, Items:get("minecraft:horn_coral")) or
        I:isOf(item, Items:get("minecraft:tube_coral")) or

        I:isOf(item, Items:get("minecraft:dead_fire_coral")) or
        I:isOf(item, Items:get("minecraft:dead_brain_coral")) or
        I:isOf(item, Items:get("minecraft:dead_bubble_coral")) or
        I:isOf(item, Items:get("minecraft:dead_horn_coral")) or
        I:isOf(item, Items:get("minecraft:dead_tube_coral")) or


        I:isOf(item, Items:get("minecraft:fire_coral_fan")) or
        I:isOf(item, Items:get("minecraft:brain_coral_fan")) or
        I:isOf(item, Items:get("minecraft:bubble_coral_fan")) or
        I:isOf(item, Items:get("minecraft:horn_coral_fan")) or
        I:isOf(item, Items:get("minecraft:tube_coral_fan")) or

        I:isOf(item, Items:get("minecraft:dead_fire_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_brain_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_bubble_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_horn_coral_fan")) or
        I:isOf(item, Items:get("minecraft:dead_tube_coral_fan"))
    ) then
    M:moveY(matrices, 0.03)
    M:rotateZ(matrices, -8)
    M:rotateY(matrices, 4)
    M:rotateX(matrices, -5)
end

if mainHand and I:isOf(item, Items:get("minecraft:end_rod")) then
    M:rotateZ(matrices, 5)
    M:rotateX(matrices, -3)
    M:moveY(matrices, 0.03)
end

if not mainHand and I:isOf(item, Items:get("minecraft:end_rod")) then
    M:rotateZ(matrices, -5)
    M:rotateX(matrices, -3)
    M:moveY(matrices, 0.03)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:splash_potion")) or
        I:isOf(item, Items:get("minecraft:lingering_potion")) or
        I:isOf(item, Items:get("minecraft:glass_bottle")) or
        I:isOf(item, Items:get("minecraft:ghast_tear")) or
        I:isOf(item, Items:get("minecraft:experience_bottle")) or
        I:isOf(item, Items:get("minecraft:dragon_breath"))
    ) and ${potions} then
    M:moveZ(matrices, 0.03)
    M:rotateY(matrices, 3.5)
    M:rotateZ(matrices, 0.5)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:splash_potion")) or
        I:isOf(item, Items:get("minecraft:lingering_potion")) or
        I:isOf(item, Items:get("minecraft:glass_bottle")) or
        I:isOf(item, Items:get("minecraft:ghast_tear")) or
        I:isOf(item, Items:get("minecraft:experience_bottle")) or
        I:isOf(item, Items:get("minecraft:dragon_breath"))
    ) and ${potions} then
    M:moveZ(matrices, 0.03)
    M:rotateY(matrices, -3.5)
    M:rotateZ(matrices, -0.5)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:potion")) or
        I:isOf(item, Items:get("minecraft:honey_bottle")) or
        I:isOf(item, Items:get("minecraft:ominous_bottle"))
    ) and ${potions} then
    M:moveZ(matrices, 0.03)
    M:rotateY(matrices, 3.5)
    M:rotateZ(matrices, 0.5)
    M:moveX(matrices, 0.04 * l * foodcount)
    M:rotateZ(matrices, 8 * l * foodcount)
    M:rotateY(matrices, 6 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:potion")) or
        I:isOf(item, Items:get("minecraft:honey_bottle")) or
        I:isOf(item, Items:get("minecraft:ominous_bottle"))
    ) and ${potions} then
    M:moveZ(matrices, 0.03)
    M:rotateY(matrices, -3.5)
    M:rotateZ(matrices, -0.5)
    M:moveX(matrices, 0.04 * l * foodcount)
    M:rotateZ(matrices, 8 * l * foodcount)
    M:rotateY(matrices, 6 * l * foodcount)
end

if mainHand and I:isOf(item, Items:get("minecraft:mace")) then
    M:moveX(matrices, 0.045)
    M:rotateX(matrices, -7.5)
    M:rotateZ(matrices, 4)
end

if not mainHand and I:isOf(item, Items:get("minecraft:mace")) then
    M:moveX(matrices, -0.045)
    M:rotateX(matrices, -7.5)
    M:rotateZ(matrices, -4)
end

if I:isIn(context.item, Tags:getVanillaTag("banners")) then
    M:moveX(matrices, 0)
    M:moveY(matrices, 0.200)
    M:moveZ(matrices, 0.08)
    M:rotateX(matrices, -66)
    M:rotateY(matrices, -13)
    M:rotateZ(matrices, -30)
end

if I:isOf(item, Items:get("minecraft:shears")) and mainHand and ${shears} then
    M:rotateZ(matrices, -45)
    M:rotateX(matrices, -65)
    M:moveZ(matrices, -0.1)
end

if I:isOf(item, Items:get("minecraft:shears")) and not mainHand and ${shears} then
    M:rotateZ(matrices, -45)
    M:rotateX(matrices, 65)
    M:moveZ(matrices, 0.1)
    M:moveY(matrices, 0.1)
end

if I:isOf(item, Items:get("minecraft:shears")) and animator ~= nil and ${shears} then
    local strength = customMainSwing or customOffSwing or swingProgress or 0
    local eased = math.sin(strength * math.pi)
    local angle = 5 * eased

    local rx, ry, rz = 0, 0, 0
    local lx, ly, lz = 0.6, 0, 0

    animator:rotateZ(0, 30, angle, rx, ry, rz)
    animator:rotateZ(30, 60, -angle, lx, ly, lz)

    if s == nil then
        s = false
    end

    if strength > 0.4 and not s then
        S:playSound("item.shears.snip", 0.5)
        s = true
    end

    if strength < 0.4 then
        s = false
    end
end

-- Foods

if mainHand and I:isOf(item, Items:get("minecraft:milk_bucket")) and ${buckets}
then
    M:rotateY(matrices, 7 * l * foodcount)
end

if not mainHand and I:isOf(item, Items:get("minecraft:milk_bucket")) and ${buckets} then
    M:rotateY(matrices, 7 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:cooked_porkchop")) or
        I:isOf(item, Items:get("minecraft:porkchop")) or
        I:isOf(item, Items:get("minecraft:cooked_beef")) or
        I:isOf(item, Items:get("minecraft:beef"))
    ) and ${foods} then
    M:moveX(matrices, 0.07 * l * foodcount )
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:cooked_porkchop")) or
        I:isOf(item, Items:get("minecraft:porkchop")) or
        I:isOf(item, Items:get("minecraft:cooked_beef")) or
        I:isOf(item, Items:get("minecraft:beef"))
    ) and ${foods} then
    M:moveX(matrices, 0.1 * l * foodcount )
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:melon_slice")) or
        I:isOf(item, Items:get("minecraft:glistering_melon_slice"))
    ) and ${foods} then
    M:moveX(matrices, 0.06)
    M:moveX(matrices, -0.01 * l * foodcount)
    M:moveZ(matrices, 0.08 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:melon_slice")) or
        I:isOf(item, Items:get("minecraft:glistering_melon_slice"))
    ) and ${foods} then
    M:moveX(matrices, -0.06)
    M:moveX(matrices, 0.01 * l * foodcount)
    M:moveZ(matrices, -0.08 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:salmon")) or
        I:isOf(item, Items:get("minecraft:cooked_salmon")) or
        I:isOf(item, Items:get("minecraft:tropical_fish"))
    ) and ${foods} then
    M:moveZ(matrices, 0.06 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:salmon")) or
        I:isOf(item, Items:get("minecraft:cooked_salmon")) or
        I:isOf(item, Items:get("minecraft:tropical_fish"))
    ) and ${foods} then
    M:moveZ(matrices, 0.06 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:cod")) or
        I:isOf(item, Items:get("minecraft:cooked_cod"))
    ) and ${foods} then
    M:moveZ(matrices, 0.03 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:cod")) or
        I:isOf(item, Items:get("minecraft:cooked_cod"))
    ) and ${foods} then
    M:moveZ(matrices, 0.03 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:chorus_fruit"))
    ) and ${foods} then
    M:rotateY(matrices, 20 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:chorus_fruit"))
    ) and ${foods} then
    M:rotateY(matrices, 20 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:pufferfish"))) and ${foods} then
    M:rotateY(matrices, 6 * l * foodcount)
    M:rotateZ(matrices, -6 * l * foodcount)
    M:moveZ(matrices, 0.1 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:pufferfish"))) and ${foods} then
    M:rotateY(matrices, -6 * l * foodcount)
    M:rotateZ(matrices, 6 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:mushroom_stew")) or
        I:isOf(item, Items:get("minecraft:beetroot_soup")) or
        I:isOf(item, Items:get("minecraft:rabbit_stew")) or
        I:isOf(item, Items:get("minecraft:suspicious_stew"))) and ${foods} then
    M:moveX(matrices, 0.04)
    M:moveZ(matrices, 0.25)
    M:rotateX(matrices, -90)
    M:rotateX(matrices, 15 * l * foodcount)
    M:rotateY(matrices, 6 * l * foodcount)
    M:moveY(matrices, -0.1 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:mushroom_stew")) or
        I:isOf(item, Items:get("minecraft:beetroot_soup")) or
        I:isOf(item, Items:get("minecraft:rabbit_stew")) or
        I:isOf(item, Items:get("minecraft:suspicious_stew"))) and ${foods} then
    M:moveX(matrices, -0.04)
    M:moveZ(matrices, 0.25)
    M:rotateX(matrices, -90)
    M:rotateX(matrices, -15 * l * foodcount)
    M:moveY(matrices, 0.04 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:rabbit")) or
        I:isOf(item, Items:get("minecraft:cooked_rabbit"))) and ${foods} then
    M:moveZ(matrices, 0.1 * l * foodcount)
    M:rotateY(matrices, 90 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:rabbit")) or
        I:isOf(item, Items:get("minecraft:cooked_rabbit"))) and ${foods} then
    M:moveZ(matrices, 0.1 * l * foodcount)
    M:rotateY(matrices, 90 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:golden_carrot")) or
        I:isOf(item, Items:get("minecraft:beetroot"))) and ${foods} then
    M:moveY(matrices, 0.15)
    M:moveX(matrices, -0.10)
    M:moveZ(matrices, 0.02)
    M:rotateX(matrices, 90)

    M:rotateX(matrices, -95 * l * foodcount)
    M:rotateY(matrices, 1 * l * foodcount)
    M:rotateZ(matrices, -7 * l * foodcount)
    M:moveY(matrices, -0.15 * foodcount)
    M:moveX(matrices, 0.2 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:golden_carrot")) or
        I:isOf(item, Items:get("minecraft:beetroot"))) and ${foods} then
    M:moveY(matrices, 0.175)
    M:moveX(matrices, -0.17 * l)
    M:moveZ(matrices, 0.025)

    M:rotateX(matrices, 90)

    M:rotateX(matrices, 90 * l * foodcount)
    M:rotateX(matrices, -5 * foodcount)

    M:moveY(matrices, -0.12 * foodcount)
    M:moveX(matrices, 0.2 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:carrot"))) and ${foods} then
    M:moveY(matrices, 0.15)
    M:moveX(matrices, -0.08)
    M:moveZ(matrices, 0.02)
    M:rotateX(matrices, 90)

    M:rotateX(matrices, -95 * l * foodcount)
    M:rotateY(matrices, 4 * l * foodcount)
    M:rotateZ(matrices, -10 * l * foodcount)
    M:moveY(matrices, -0.15 * foodcount)
    M:moveX(matrices, 0.2 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:carrot"))) and ${foods} then
    M:moveY(matrices, 0.15)
    M:moveX(matrices, 0.14)
    M:moveZ(matrices, 0.02)
    M:rotateX(matrices, 90)

    M:rotateX(matrices, 95 * l * foodcount)
    M:rotateY(matrices, 4 * l * foodcount)
    M:rotateZ(matrices, -10 * l * foodcount)
    M:moveY(matrices, -0.15 * foodcount)
    M:moveX(matrices, 0.2 * l * foodcount)
end

if mainHand and I:isOf(item, Items:get("minecraft:sweet_berries")) and ${foods}
then
    M:scale(matrices, 0.9, 0.9, 0.9)
    M:moveX(matrices, 0.1)
    M:moveZ(matrices, 0.1 * l * foodcount)
end

if not mainHand and I:isOf(item, Items:get("minecraft:sweet_berries")) and ${foods} then
    M:scale(matrices, 0.9, 0.9, 0.9)
    M:moveX(matrices, -0.1)
    M:moveZ(matrices, -0.1 * l * foodcount)
    M:moveX(matrices, 0.05 * l * foodcount)
end

if mainHand and I:isOf(item, Items:get("minecraft:rotten_flesh")) and ${foods} then
    M:moveY(matrices, 0.3)
    M:moveX(matrices, 0.06)
    M:rotateX(matrices, 90)

    M:rotateX(matrices, -105 * l * foodcount)
    M:moveY(matrices, -0.3 * l * foodcount)
end

if not mainHand and I:isOf(item, Items:get("minecraft:rotten_flesh")) and ${foods} then
    M:moveY(matrices, 0.3)
    M:moveX(matrices, -0.06)
    M:rotateX(matrices, 90)

    M:rotateX(matrices, 105 * l * foodcount)
    M:moveY(matrices, 0.3 * l * foodcount)
end

if mainHand and I:isOf(item, Items:get("minecraft:potato")) and ${foods} then
    M:moveX(matrices, 0.05)
    M:rotateY(matrices, 5 * l * foodcount)
    M:rotateZ(matrices, -7 * l * foodcount)
end

if not mainHand and I:isOf(item, Items:get("minecraft:potato")) and ${foods} then
    M:moveX(matrices, -0.05)
    M:rotateY(matrices, 5 * l * foodcount)
    M:rotateZ(matrices, -7 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:cod")) or
        I:isOf(item, Items:get("minecraft:cooked_cod"))) and ${foods} then
    M:moveX(matrices, 0.03)
    M:moveZ(matrices, 0.1)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:cod")) or
        I:isOf(item, Items:get("minecraft:cooked_cod"))) and ${foods} then
    M:moveX(matrices, -0.03)
    M:moveZ(matrices, 0.1)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:baked_potato")) or
        I:isOf(item, Items:get("minecraft:poisonous_potato")) or
        I:isOf(item, Items:get("minecraft:pufferfish"))) and ${foods} then
    M:moveX(matrices, 0.03)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:baked_potato")) or
        I:isOf(item, Items:get("minecraft:poisonous_potato")) or
        I:isOf(item, Items:get("minecraft:pufferfish"))) and ${foods} then
    M:moveX(matrices, -0.03)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:apple")) or
        I:isOf(item, Items:get("minecraft:golden_apple")) or
        I:isOf(item, Items:get("minecraft:bread")) or
        I:isOf(item, Items:get("minecraft:enchanted_golden_apple"))) and ${foods} then
    M:moveX(matrices, 0)
    M:moveX(matrices, 0.06 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:apple")) or
        I:isOf(item, Items:get("minecraft:golden_apple")) or
        I:isOf(item, Items:get("minecraft:bread")) or
        I:isOf(item, Items:get("minecraft:enchanted_golden_apple"))) and ${foods} then
    M:moveX(matrices, 0)
    M:moveX(matrices, 0.03 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:mutton")) or
        I:isOf(item, Items:get("minecraft:cooked_mutton"))) and ${foods} then
    M:moveX(matrices, 0.05 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:mutton")) or
        I:isOf(item, Items:get("minecraft:cooked_mutton"))) and ${foods} then
    M:moveX(matrices, -0.05 * l * foodcount)
end

if mainHand and (
        I:isOf(item, Items:get("minecraft:spider_eye"))) and ${foods} then
    M:moveX(matrices, 0.05 * l * foodcount)
end

if not mainHand and (
        I:isOf(item, Items:get("minecraft:spider_eye"))) and ${foods} then
    M:moveX(matrices, -0.08 * l * foodcount)
end

-- glowing

if I:isOf(item, Items:get("minecraft:blaze_powder")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.08, 0.1,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:fire_charge")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.08, 0.1,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:glowstone_dust")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.08, 0.1,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end


if I:isOf(item, Items:get("minecraft:redstone")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.08, 0.1,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/r_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end


if I:isOf(item, Items:get("minecraft:prismarine_crystals")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.1, 0.1,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        2.5,
        Texture:of("minecraft", "textures/particle/w_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:nether_star")) then
    particleManager:addParticle(
        particles, false,
        0.1 * l, 0.2, 0,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3,
        Texture:of("minecraft", "textures/particle/w_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:torch")) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.12 * l, 0.2, 0,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        200 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:copper_torch")) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.12 * l, 0.2, 0,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/g_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        200 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:soul_torch")) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.12 * l, 0.2, 0,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3.5,
        Texture:of("minecraft", "textures/particle/b_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:lantern")) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.08 * 2, 0, -0.55,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        4,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:soul_lantern")) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.08 * 2, 0, -0.55,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        4,
        Texture:of("minecraft", "textures/particle/b_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        125 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if (I:isOf(item, Items:get("minecraft:copper_lantern")) or
I:isOf(item, Items:get("waxed_copper_lantern")) or
I:isOf(item, Items:get("minecraft:exposed_copper_lantern")) or
I:isOf(item, Items:get("waxed_exposed_copper_lantern")) or
I:isOf(item, Items:get("minecraft:oxidized_copper_lantern")) or
I:isOf(item, Items:get("waxed_oxidized_copper_lantern")) or
I:isOf(item, Items:get("minecraft:weathered_copper_lantern")) or
I:isOf(item, Items:get("minecraft:waxed_weathered_copper_lantern"))) and ${torchsAndLanterns} then
    particleManager:addParticle(
        particles, false,
        0.08 * 2, 0, -0.55,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        4,
        Texture:of("minecraft", "textures/particle/g_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:totem_of_undying")) and ${TotemOfUndying} then
    particleManager:addParticle(
        particles, false,
        -0.03 * l, 0.113, 0.19,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        3,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        130 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:end_rod")) then
    particleManager:addParticle(
        particles, false,
        0.02 * 2, 0.35, 0.1,
        0, 0, 0,
        10, 0, 0, 0, 0, 0,
        3,
        Texture:of("minecraft", "textures/particle/w_wertical_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:diamond")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.2, 0.2,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        2.5,
        Texture:of("minecraft", "textures/particle/b_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:emerald")) then
    particleManager:addParticle(
        particles, false,
        0 * l, 0.2, 0.2,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        2.5,
        Texture:of("minecraft", "textures/particle/g_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:sentry_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:dune_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:coast_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:wild_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:ward_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:eye_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:vex_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:tide_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:snout_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:rib_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:spire_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:wayfinder_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:shaper_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:silence_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:raiser_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:host_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:flow_armor_trim_smithing_template")) or
    I:isOf(item, Items:get("minecraft:netherite_upgrade_smithing_template")) or
    I:isOf(item, Items:get("minecraft:bolt_armor_trim_smithing_template"))
then
    particleManager:addParticle(
        particles, false,
        0.02 * l, 0.24, 0.2,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        2.5,
        Texture:of("minecraft", "textures/particle/b_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end

if I:isOf(item, Items:get("minecraft:enchanted_golden_apple")) then
    particleManager:addParticle(
        particles, false,
        -0.03 * l, 0.2, 0.2,
        0, 0, 0,
        0, 0, 0, 0, 0, 0,
        2,
        Texture:of("minecraft", "textures/particle/o_glow.png"),
        "ITEM", hand, "SPAWN", "ADDITIVE", 0,
        150 + (20 * M:sin(P:getAge(player) * 0.2))
    )
end