import { world, BlockPermutation, GameMode } from "@minecraft/server";

world.afterEvents.playerBreakBlock.subscribe(eventData => {
  const player = eventData.player;
  const itemUsed = eventData.itemStackBeforeBreak;
  const brokenBlock = eventData.brokenBlockPermutation;
  const playerEquippable = player.getComponent("equippable");
  const instantDiggableBlocks = [
    "minecraft:acacia_sapling",
    "minecraft:allium",
    "minecraft:azalea",
    "minecraft:azure_bluet",
    "minecraft:beetroot",
    "minecraft:birch_sapling",
    "minecraft:blue_orchid",
    "minecraft:brain_coral",
    "minecraft:brain_coral_fan",
    "minecraft:brown_mushroom",
    "minecraft:bubble_coral",
    "minecraft:bubble_coral_fan",
    "minecraft:carrots",
    "minecraft:cave_vines",
    "minecraft:cave_vines_body_with_berries",
    "minecraft:cave_vines_head_with_berries",
    "minecraft:cherry_sapling",
    "minecraft:coral_fan_dead",
    "minecraft:coral_fan_hang",
    "minecraft:coral_fan_hang2",
    "minecraft:coral_fan_hang3",
    "minecraft:cornflower",
    "minecraft:crimson_fungus",
    "minecraft:crimson_roots",
    "minecraft:dark_oak_sapling",
    "minecraft:dead_brain_coral",
    "minecraft:dead_brain_coral_fan",
    "minecraft:dead_bubble_coral",
    "minecraft:dead_bubble_coral_fan",
    "minecraft:dead_fire_coral",
    "minecraft:dead_fire_coral_fan",
    "minecraft:dead_horn_coral",
    "minecraft:dead_horn_coral_fan",
    "minecraft:dead_tube_coral",
    "minecraft:dead_tube_coral_fan",
    "minecraft:deadbush",
    "minecraft:decorated_pot",
    "minecraft:double_plant", // old name
    "minecraft:end_rod",
    "minecraft:fern",
    "minecraft:fire",
    "minecraft:fire_coral",
    "minecraft:fire_coral_fan",
    "minecraft:flowering_azalea",
    "minecraft:flower_pot",
    "minecraft:frog_spawn",
    "minecraft:honey_block",
    "minecraft:hanging_roots",
    "minecraft:horn_coral",
    "minecraft:horn_coral_fan",
    "minecraft:jungle_sapling",
    "minecraft:kelp",
    "minecraft:lily_of_the_valley",
    "minecraft:mangrove_propagule",
    "minecraft:melon_stem",
    "minecraft:nether_sprouts",
    "minecraft:nether_wart",
    "minecraft:oak_sapling",
    "minecraft:orange_tulip",
    "minecraft:oxeye_daisy",
    "minecraft:pink_petals",
    "minecraft:pink_tulip",
    "minecraft:pitcher_plant",
    "minecraft:poppy",
    "minecraft:potatoes",
    "minecraft:powered_comparator",
    "minecraft:powered_repeater",
    "minecraft:pumpkin_stem",
    "minecraft:red_flower", // old name
    "minecraft:red_mushroom",
    "minecraft:red_tulip",
    "minecraft:redstone_torch",
    "minecraft:redstone_wire",
    "minecraft:reeds",
    "minecraft:sea_pickle",
    "minecraft:seagrass",
    "minecraft:short_grass",
    "minecraft:slime",
    "minecraft:soul_fire",
    "minecraft:soul_torch",
    "minecraft:spore_blossom",
    "minecraft:spruce_sapling",
    "minecraft:sweet_berry_bush",
    "minecraft:tallgrass", // old name
    "minecraft:tnt",
    "minecraft:torch",
    "minecraft:torchflower",
    "minecraft:tube_coral",
    "minecraft:tube_coral_fan",
    "minecraft:trip_wire",
    "minecraft:tripwire_hook",
    "minecraft:twisting_vines",
    "minecraft:unlit_redstone_torch",
    "minecraft:unpowered_comparator",
    "minecraft:unpowered_repeater",
    "minecraft:warped_fungus",
    "minecraft:warped_roots",
    "minecraft:waterlily",
    "minecraft:weeping_vines",
    "minecraft:wheat",
    "minecraft:white_tulip",
    "minecraft:wither_rose",
    "minecraft:yellow_flower",
    "minecraft:tall_grass",
    "minecraft:large_fern",
    "minecraft:sunflower",
    "minecraft:lilac",
    "minecraft:rose_bush",
    "minecraft:peony"
  ]
  const customAxes = [
    "nicothekid:brass_axe",
    "nicothekid:bronze_axe",
    "nicothekid:olivine_axe",
    "nicothekid:tin_axe",
    "nicothekid:zinc_axe"
  ]
  const axeDiggableBlocks = [
    "minecraft:acacia_button",
    "minecraft:acacia_door",
    "minecraft:acacia_double_slab",
    "minecraft:acacia_fence",
    "minecraft:acacia_fence_gate",
    "minecraft:acacia_hanging_sign",
    "minecraft:acacia_log",
    "minecraft:acacia_planks",
    "minecraft:acacia_pressure_plate",
    "minecraft:acacia_slab",
    "minecraft:acacia_stairs",
    "minecraft:acacia_standing_sign",
    "minecraft:acacia_trapdoor",
    "minecraft:acacia_wall_sign",
    "minecraft:acacia_wood",
    "minecraft:bamboo",
    "minecraft:bamboo_block",
    "minecraft:bamboo_button",
    "minecraft:bamboo_door",
    "minecraft:bamboo_double_slab",
    "minecraft:bamboo_fence",
    "minecraft:bamboo_fence_gate",
    "minecraft:bamboo_hanging_sign",
    "minecraft:bamboo_mosaic",
    "minecraft:bamboo_mosaic_double_slab",
    "minecraft:bamboo_mosaic_slab",
    "minecraft:bamboo_mosaic_stairs",
    "minecraft:bamboo_planks",
    "minecraft:bamboo_pressure_plate",
    "minecraft:bamboo_sapling",
    "minecraft:bamboo_slab",
    "minecraft:bamboo_stairs",
    "minecraft:bamboo_standing_sign",
    "minecraft:bamboo_trapdoor",
    "minecraft:bamboo_wall_sign",
    "minecraft:barrel",
    "minecraft:bee_nest",
    "minecraft:beehive",
    "minecraft:birch_button",
    "minecraft:birch_door",
    "minecraft:birch_double_slab",
    "minecraft:birch_fence",
    "minecraft:birch_fence_gate",
    "minecraft:birch_hanging_sign",
    "minecraft:birch_log",
    "minecraft:birch_planks",
    "minecraft:birch_pressure_plate",
    "minecraft:birch_slab",
    "minecraft:birch_stairs",
    "minecraft:birch_standing_sign",
    "minecraft:birch_trapdoor",
    "minecraft:birch_wall_sign",
    "minecraft:birch_wood",
    "minecraft:bookshelf",
    "minecraft:brown_mushroom_block",
    "minecraft:campfire",
    "minecraft:cartography_table",
    "minecraft:carved_pumpkin",
    "minecraft:cherry_button",
    "minecraft:cherry_door",
    "minecraft:cherry_double_slab",
    "minecraft:cherry_fence",
    "minecraft:cherry_fence_gate",
    "minecraft:cherry_hanging_sign",
    "minecraft:cherry_log",
    "minecraft:cherry_planks",
    "minecraft:cherry_pressure_plate",
    "minecraft:cherry_slab",
    "minecraft:cherry_stairs",
    "minecraft:cherry_standing_sign",
    "minecraft:cherry_trapdoor",
    "minecraft:cherry_wall_sign",
    "minecraft:cherry_wood",
    "minecraft:chest",
    "minecraft:chiseled_bookshelf",
    "minecraft:chorus_flower",
    "minecraft:chorus_plant",
    "minecraft:cocoa",
    "minecraft:composter",
    "minecraft:crafting_table",
    "minecraft:crimson_button",
    "minecraft:crimson_door",
    "minecraft:crimson_double_slab",
    "minecraft:crimson_fence",
    "minecraft:crimson_fence_gate",
    "minecraft:crimson_hanging_sign",
    "minecraft:crimson_hyphae",
    "minecraft:crimson_planks",
    "minecraft:crimson_pressure_plate",
    "minecraft:crimson_slab",
    "minecraft:crimson_stairs",
    "minecraft:crimson_standing_sign",
    "minecraft:crimson_stem",
    "minecraft:crimson_trapdoor",
    "minecraft:crimson_wall_sign",
    "minecraft:dark_oak_button",
    "minecraft:dark_oak_door",
    "minecraft:dark_oak_double_slab",
    "minecraft:dark_oak_fence",
    "minecraft:dark_oak_fence_gate",
    "minecraft:dark_oak_hanging_sign",
    "minecraft:dark_oak_log",
    "minecraft:dark_oak_planks",
    "minecraft:dark_oak_pressure_plate",
    "minecraft:dark_oak_slab",
    "minecraft:dark_oak_stairs",
    "minecraft:dark_oak_trapdoor",
    "minecraft:dark_oak_wood",
    "minecraft:darkoak_standing_sign",
    "minecraft:darkoak_wall_sign",
    "minecraft:daylight_detector",
    "minecraft:daylight_detector_inverted",
    "minecraft:fence", // old name
    "minecraft:fence_gate",
    "minecraft:fletching_table",
    "minecraft:jukebox",
    "minecraft:jungle_button",
    "minecraft:jungle_door",
    "minecraft:jungle_double_slab",
    "minecraft:jungle_fence",
    "minecraft:jungle_fence_gate",
    "minecraft:jungle_hanging_sign",
    "minecraft:jungle_log",
    "minecraft:jungle_planks",
    "minecraft:jungle_pressure_plate",
    "minecraft:jungle_slab",
    "minecraft:jungle_stairs",
    "minecraft:jungle_standing_sign",
    "minecraft:jungle_trapdoor",
    "minecraft:jungle_wall_sign",
    "minecraft:jungle_wood",
    "minecraft:ladder",
    "minecraft:lectern",
    "minecraft:lit_pumpkin",
    "minecraft:log", // old name
    "minecraft:log2", // old name
    "minecraft:loom",
    "minecraft:mangrove_button",
    "minecraft:mangrove_door",
    "minecraft:mangrove_double_slab",
    "minecraft:mangrove_fence",
    "minecraft:mangrove_fence_gate",
    "minecraft:mangrove_hanging_sign",
    "minecraft:mangrove_log",
    "minecraft:mangrove_planks",
    "minecraft:mangrove_pressure_plate",
    "minecraft:mangrove_roots",
    "minecraft:mangrove_slab",
    "minecraft:mangrove_stairs",
    "minecraft:mangrove_standing_sign",
    "minecraft:mangrove_trapdoor",
    "minecraft:mangrove_wall_sign",
    "minecraft:mangrove_wood",
    "minecraft:melon_block",
    "minecraft:noteblock",
    "minecraft:oak_double_slab",
    "minecraft:oak_fence",
    "minecraft:oak_hanging_sign",
    "minecraft:oak_log",
    "minecraft:oak_planks",
    "minecraft:oak_slab",
    "minecraft:oak_stairs",
    "minecraft:oak_wood",
    "minecraft:pumpkin",
    "minecraft:red_mushroom_block",
    "minecraft:smithing_table",
    "minecraft:soul_campfire",
    "minecraft:spruce_button",
    "minecraft:spruce_door",
    "minecraft:spruce_double_slab",
    "minecraft:spruce_fence",
    "minecraft:spruce_fence_gate",
    "minecraft:spruce_hanging_sign",
    "minecraft:spruce_log",
    "minecraft:spruce_planks",
    "minecraft:spruce_pressure_plate",
    "minecraft:spruce_slab",
    "minecraft:spruce_stairs",
    "minecraft:spruce_standing_sign",
    "minecraft:spruce_trapdoor",
    "minecraft:spruce_wall_sign",
    "minecraft:spruce_wood",
    "minecraft:standing_banner",
    "minecraft:standing_sign",
    "minecraft:stripped_acacia_log",
    "minecraft:stripped_acacia_wood",
    "minecraft:stripped_bamboo_block",
    "minecraft:stripped_birch_log",
    "minecraft:stripped_birch_wood",
    "minecraft:stripped_cherry_log",
    "minecraft:stripped_cherry_wood",
    "minecraft:stripped_crimson_hyphae",
    "minecraft:stripped_crimson_stem",
    "minecraft:stripped_dark_oak_log",
    "minecraft:stripped_dark_oak_wood",
    "minecraft:stripped_jungle_log",
    "minecraft:stripped_jungle_wood",
    "minecraft:stripped_mangrove_log",
    "minecraft:stripped_mangrove_wood",
    "minecraft:stripped_oak_log",
    "minecraft:stripped_oak_wood",
    "minecraft:stripped_spruce_log",
    "minecraft:stripped_spruce_wood",
    "minecraft:stripped_warped_hyphae",
    "minecraft:stripped_warped_stem",
    "minecraft:trapdoor",
    "minecraft:trapped_chest",
    "minecraft:vine",
    "minecraft:wall_banner",
    "minecraft:wall_sign",
    "minecraft:warped_button",
    "minecraft:warped_door",
    "minecraft:warped_double_slab",
    "minecraft:warped_fence",
    "minecraft:warped_fence_gate",
    "minecraft:warped_hanging_sign",
    "minecraft:warped_hyphae",
    "minecraft:warped_planks",
    "minecraft:warped_pressure_plate",
    "minecraft:warped_slab",
    "minecraft:warped_stairs",
    "minecraft:warped_standing_sign",
    "minecraft:warped_stem",
    "minecraft:warped_trapdoor",
    "minecraft:warped_wall_sign",
    "minecraft:wooden_button",
    "minecraft:wooden_door",
    "minecraft:wooden_pressure_plate"
  ]
  const customHoes = [
    "nicothekid:brass_hoe",
    "nicothekid:bronze_hoe",
    "nicothekid:olivine_hoe",
    "nicothekid:tin_hoe",
    "nicothekid:zinc_hoe"
  ]
  const hoeDiggableBlocks = [
    "minecraft:acacia_leaves",
    "minecraft:azalea_leaves",
    "minecraft:azalea_leaves_flowered",
    "minecraft:birch_leaves",
    "minecraft:calibrated_sculk_sensor",
    "minecraft:cherry_leaves",
    "minecraft:dark_oak_leaves",
    "minecraft:hay_block",
    "minecraft:jungle_leaves",
    "minecraft:mangrove_leaves",
    "minecraft:nether_wart_block",
    "minecraft:oak_leaves",
    "minecraft:shroomlight",
    "minecraft:sculk",
    "minecraft:sculk_vein",
    "minecraft:sculk_catalyst",
    "minecraft:sculk_sensor",
    "minecraft:sculk_shrieker",
    "minecraft:sponge",
    "minecraft:spruce_leaves",
    "minecraft:target",
    "minecraft:warped_wart_block"
  ]
  const customPickaxes = [
    "nicothekid:brass_pickaxe",
    "nicothekid:bronze_pickaxe",
    "nicothekid:olivine_pickaxe",
    "nicothekid:tin_pickaxe",
    "nicothekid:zinc_pickaxe"
  ]
  const pickaxeDiggableBlocks = [
    "minecraft:activator_rail",
    "minecraft:amethyst_block",
    "minecraft:amethyst_cluster",
    "minecraft:ancient_debris",
    "minecraft:andesite",
    "minecraft:andesite_stairs",
    "minecraft:anvil",
    "minecraft:basalt",
    "minecraft:bell",
    "minecraft:black_concrete",
    "minecraft:black_glazed_terracotta",
    "minecraft:black_shulker_box",
    "minecraft:black_terracotta",
    "minecraft:blackstone",
    "minecraft:blackstone_double_slab",
    "minecraft:blackstone_slab",
    "minecraft:blackstone_stairs",
    "minecraft:blackstone_wall",
    "minecraft:blast_furnace",
    "minecraft:blue_concrete",
    "minecraft:blue_glazed_terracotta",
    "minecraft:blue_ice",
    "minecraft:blue_shulker_box",
    "minecraft:blue_terracotta",
    "minecraft:bone_block",
    "minecraft:brain_coral_block",
    "minecraft:brewing_stand",
    "minecraft:brick_block",
    "minecraft:brick_slab",
    "minecraft:brick_stairs",
    "minecraft:brown_concrete",
    "minecraft:brown_glazed_terracotta",
    "minecraft:brown_shulker_box",
    "minecraft:brown_terracotta",
    "minecraft:bubble_coral_block",
    "minecraft:budding_amethyst",
    "minecraft:calcite",
    "minecraft:cauldron",
    "minecraft:chain",
    "minecraft:chiseled_copper",
    "minecraft:chiseled_deepslate",
    "minecraft:chiseled_nether_bricks",
    "minecraft:chiseled_polished_blackstone",
    "minecraft:chiseled_tuff",
    "minecraft:chiseled_tuff_bricks",
    "minecraft:coal_block",
    "minecraft:coal_ore",
    "minecraft:cobbled_deepslate",
    "minecraft:cobbled_deepslate_double_slab",
    "minecraft:cobbled_deepslate_slab",
    "minecraft:cobbled_deepslate_stairs",
    "minecraft:cobbled_deepslate_wall",
    "minecraft:cobblestone",
    "minecraft:cobblestone_slab",
    "minecraft:cobblestone_wall",
    "minecraft:concrete", // old name
    "minecraft:conduit",
    "minecraft:copper_block",
    "minecraft:copper_bulb",
    "minecraft:copper_door",
    "minecraft:copper_grate",
    "minecraft:copper_ore",
    "minecraft:copper_trapdoor",
    "minecraft:coral_block", // old name
    "minecraft:cracked_deepslate_bricks",
    "minecraft:cracked_deepslate_tiles",
    "minecraft:cracked_nether_bricks",
    "minecraft:cracked_polished_blackstone_bricks",
    "minecraft:crafter",
    "minecraft:crimson_nylium",
    "minecraft:crying_obsidian",
    "minecraft:cut_copper",
    "minecraft:cut_copper_slab",
    "minecraft:cut_copper_stairs",
    "minecraft:cyan_concrete",
    "minecraft:cyan_glazed_terracotta",
    "minecraft:cyan_shulker_box",
    "minecraft:cyan_terracotta",
    "minecraft:dark_prismarine_stairs",
    "minecraft:dead_brain_coral_block",
    "minecraft:dead_bubble_coral_block",
    "minecraft:dead_fire_coral_block",
    "minecraft:dead_horn_coral_block",
    "minecraft:dead_tube_coral_block",
    "minecraft:deepslate",
    "minecraft:deepslate_brick_double_slab",
    "minecraft:deepslate_brick_slab",
    "minecraft:deepslate_brick_stairs",
    "minecraft:deepslate_brick_wall",
    "minecraft:deepslate_bricks",
    "minecraft:deepslate_coal_ore",
    "minecraft:deepslate_copper_ore",
    "minecraft:deepslate_gold_ore",
    "minecraft:deepslate_iron_ore",
    "minecraft:deepslate_lapis_ore",
    "minecraft:deepslate_redstone_ore",
    "minecraft:deepslate_tile_double_slab",
    "minecraft:deepslate_tile_slab",
    "minecraft:deepslate_tile_stairs",
    "minecraft:deepslate_tile_wall",
    "minecraft:deepslate_tiles",
    "minecraft:detector_rail",
    "minecraft:diamond_block",
    "minecraft:diamond_ore",
    "minecraft:diorite",
    "minecraft:diorite_stairs",
    "minecraft:dispenser",
    "minecraft:double_cut_copper_slab",
    "minecraft:double_stone_slab",
    "minecraft:double_stone_slab2",
    "minecraft:double_stone_slab3",
    "minecraft:double_stone_slab4",
    "minecraft:dripstone_block",
    "minecraft:dropper",
    "minecraft:emerald_block",
    "minecraft:emerald_ore",
    "minecraft:enchanting_table",
    "minecraft:end_brick_stairs",
    "minecraft:end_bricks",
    "minecraft:end_stone",
    "minecraft:ender_chest",
    "minecraft:exposed_chiseled_copper",
    "minecraft:exposed_copper",
    "minecraft:exposed_copper_bulb",
    "minecraft:exposed_copper_door",
    "minecraft:exposed_copper_grate",
    "minecraft:exposed_copper_trapdoor",
    "minecraft:exposed_cut_copper",
    "minecraft:exposed_cut_copper_slab",
    "minecraft:exposed_cut_copper_stairs",
    "minecraft:exposed_double_cut_copper_slab",
    "minecraft:fire_coral_block",
    "minecraft:furnace",
    "minecraft:gilded_blackstone",
    "minecraft:gold_block",
    "minecraft:gold_ore",
    "minecraft:golden_rail",
    "minecraft:granite",
    "minecraft:granite_stairs",
    "minecraft:gray_concrete",
    "minecraft:gray_glazed_terracotta",
    "minecraft:gray_shulker_box",
    "minecraft:gray_terracotta",
    "minecraft:green_concrete",
    "minecraft:green_glazed_terracotta",
    "minecraft:green_shulker_box",
    "minecraft:green_terracotta",
    "minecraft:grindstone",
    "minecraft:hardened_clay",
    "minecraft:heavy_core",
    "minecraft:heavy_weighted_pressure_plate",
    "minecraft:hopper",
    "minecraft:horn_coral_block",
    "minecraft:ice",
    "minecraft:infested_deepslate",
    "minecraft:iron_bars",
    "minecraft:iron_block",
    "minecraft:iron_door",
    "minecraft:iron_ore",
    "minecraft:iron_trapdoor",
    "minecraft:lantern",
    "minecraft:lapis_block",
    "minecraft:lapis_ore",
    "minecraft:large_amethyst_bud",
    "minecraft:light_blue_concrete",
    "minecraft:light_blue_glazed_terracotta",
    "minecraft:light_blue_shulker_box",
    "minecraft:light_blue_terracotta",
    "minecraft:light_gray_concrete",
    "minecraft:light_gray_shulker_box",
    "minecraft:light_gray_terracotta",
    "minecraft:light_weighted_pressure_plate",
    "minecraft:lightning_rod",
    "minecraft:lime_concrete",
    "minecraft:lime_glazed_terracotta",
    "minecraft:lime_shulker_box",
    "minecraft:lime_terracotta",
    "minecraft:lit_blast_furnace",
    "minecraft:lit_furnace",
    "minecraft:lit_redstone_ore",
    "minecraft:lit_smoker",
    "minecraft:lodestone",
    "minecraft:magenta_concrete",
    "minecraft:magenta_glazed_terracotta",
    "minecraft:magenta_shulker_box",
    "minecraft:magenta_terracotta",
    "minecraft:magma",
    "minecraft:medium_amethyst_bud",
    "minecraft:mob_spawner",
    "minecraft:monster_egg",
    "minecraft:mossy_cobblestone",
    "minecraft:mossy_cobblestone_stairs",
    "minecraft:mossy_stone_brick_stairs",
    "minecraft:mud_brick_double_slab",
    "minecraft:mud_brick_slab",
    "minecraft:mud_brick_stairs",
    "minecraft:mud_brick_wall",
    "minecraft:mud_bricks",
    "minecraft:nether_brick",
    "minecraft:nether_brick_fence",
    "minecraft:nether_brick_slab",
    "minecraft:nether_brick_stairs",
    "minecraft:nether_gold_ore",
    "minecraft:netherite_block",
    "minecraft:netherrack",
    "minecraft:normal_stone_stairs",
    "minecraft:observer",
    "minecraft:obsidian",
    "minecraft:orange_concrete",
    "minecraft:orange_glazed_terracotta",
    "minecraft:orange_shulker_box",
    "minecraft:orange_terracotta",
    "minecraft:oxidized_chiseled_copper",
    "minecraft:oxidized_copper",
    "minecraft:oxidized_copper_bulb",
    "minecraft:oxidized_copper_door",
    "minecraft:oxidized_copper_grate",
    "minecraft:oxidized_copper_trapdoor",
    "minecraft:oxidized_cut_copper",
    "minecraft:oxidized_cut_copper_slab",
    "minecraft:oxidized_cut_copper_stairs",
    "minecraft:oxidized_double_cut_copper_slab",
    "minecraft:packed_ice",
    "minecraft:packed_mud",
    "minecraft:pink_concrete",
    "minecraft:pink_glazed_terracotta",
    "minecraft:pink_shulker_box",
    "minecraft:pink_terracotta",
    "minecraft:piston",
    "minecraft:pointed_dripstone",
    "minecraft:polished_andesite",
    "minecraft:polished_andesite_stairs",
    "minecraft:polished_basalt",
    "minecraft:polished_blackstone",
    "minecraft:polished_blackstone_brick_double_slab",
    "minecraft:polished_blackstone_brick_slab",
    "minecraft:polished_blackstone_brick_stairs",
    "minecraft:polished_blackstone_brick_wall",
    "minecraft:polished_blackstone_bricks",
    "minecraft:polished_blackstone_button",
    "minecraft:polished_blackstone_double_slab",
    "minecraft:polished_blackstone_pressure_plate",
    "minecraft:polished_blackstone_slab",
    "minecraft:polished_blackstone_stairs",
    "minecraft:polished_blackstone_wall",
    "minecraft:polished_deepslate",
    "minecraft:polished_deepslate_double_slab",
    "minecraft:polished_deepslate_slab",
    "minecraft:polished_deepslate_stairs",
    "minecraft:polished_deepslate_wall",
    "minecraft:polished_diorite",
    "minecraft:polished_diorite_stairs",
    "minecraft:polished_granite",
    "minecraft:polished_granite_stairs",
    "minecraft:polished_tuff",
    "minecraft:polished_tuff_double_slab",
    "minecraft:polished_tuff_slab",
    "minecraft:polished_tuff_stairs",
    "minecraft:polished_tuff_wall",
    "minecraft:prismarine",
    "minecraft:prismarine_bricks_stairs",
    "minecraft:prismarine_stairs",
    "minecraft:purple_concrete",
    "minecraft:purple_glazed_terracotta",
    "minecraft:purple_shulker_box",
    "minecraft:purple_terracotta",
    "minecraft:purpur_block",
    "minecraft:purpur_stairs",
    "minecraft:quartz_block",
    "minecraft:quartz_bricks",
    "minecraft:quartz_ore",
    "minecraft:quartz_slab",
    "minecraft:quartz_stairs",
    "minecraft:rail",
    "minecraft:raw_copper_block",
    "minecraft:raw_gold_block",
    "minecraft:raw_iron_block",
    "minecraft:red_concrete",
    "minecraft:red_glazed_terracotta",
    "minecraft:red_nether_brick",
    "minecraft:red_nether_brick_stairs",
    "minecraft:red_sandstone",
    "minecraft:red_sandstone_stairs",
    "minecraft:red_shulker_box",
    "minecraft:red_terracotta",
    "minecraft:redstone_block",
    "minecraft:redstone_ore"
    "minecraft:respawn_anchor",
    "minecraft:sandstone",
    "minecraft:sandstone_slab",
    "minecraft:sandstone_stairs",
    "minecraft:shulker_box", // old name
    "minecraft:silver_glazed_terracotta",
    "minecraft:small_amethyst_bud",
    "minecraft:smoker",
    "minecraft:smooth_basalt",
    "minecraft:smooth_quartz_stairs",
    "minecraft:smooth_red_sandstone_stairs",
    "minecraft:smooth_sandstone_stairs",
    "minecraft:smooth_stone",
    "minecraft:smooth_stone_slab",
    "minecraft:soul_lantern",
    "minecraft:stained_hardened_clay", // old name
    "minecraft:sticky_piston",
    "minecraft:stone",
    "minecraft:stone_brick_slab",
    "minecraft:stone_brick_stairs",
    "minecraft:stone_button",
    "minecraft:stone_pressure_plate",
    "minecraft:stone_slab", // removed in 1.21
    "minecraft:stone_slab2",
    "minecraft:stone_slab3",
    "minecraft:stone_slab4",
    "minecraft:stone_stairs",
    "minecraft:stonebrick",
    "minecraft:stonecutter_block",
    "minecraft:tube_coral_block",
    "minecraft:tuff",
    "minecraft:tuff_brick_double_slab",
    "minecraft:tuff_brick_slab",
    "minecraft:tuff_brick_stairs",
    "minecraft:tuff_brick_wall",
    "minecraft:tuff_bricks",
    "minecraft:tuff_double_slab",
    "minecraft:tuff_slab",
    "minecraft:tuff_stairs",
    "minecraft:tuff_wall",
    "minecraft:undyed_shulker_box",
    "minecraft:warped_nylium",
    "minecraft:waxed_chiseled_copper",
    "minecraft:waxed_copper",
    "minecraft:waxed_copper_bulb",
    "minecraft:waxed_copper_door",
    "minecraft:waxed_copper_grate",
    "minecraft:waxed_copper_trapdoor",
    "minecraft:waxed_cut_copper",
    "minecraft:waxed_cut_copper_slab",
    "minecraft:waxed_cut_copper_stairs",
    "minecraft:waxed_double_cut_copper_slab",
    "minecraft:waxed_exposed_chiseled_copper",
    "minecraft:waxed_exposed_copper",
    "minecraft:waxed_exposed_copper_bulb",
    "minecraft:waxed_exposed_copper_door",
    "minecraft:waxed_exposed_copper_grate",
    "minecraft:waxed_exposed_copper_trapdoor",
    "minecraft:waxed_exposed_cut_copper",
    "minecraft:waxed_exposed_cut_copper_slab",
    "minecraft:waxed_exposed_cut_copper_stairs",
    "minecraft:waxed_exposed_double_cut_copper_slab",
    "minecraft:waxed_oxidized_chiseled_copper",
    "minecraft:waxed_oxidized_copper",
    "minecraft:waxed_oxidized_copper_bulb",
    "minecraft:waxed_oxidized_copper_door",
    "minecraft:waxed_oxidized_copper_grate",
    "minecraft:waxed_oxidized_copper_trapdoor",
    "minecraft:waxed_oxidized_cut_copper",
    "minecraft:waxed_oxidized_cut_copper_slab",
    "minecraft:waxed_oxidized_cut_copper_stairs",
    "minecraft:waxed_oxidized_double_cut_copper_slab",
    "minecraft:waxed_weathered_chiseled_copper",
    "minecraft:waxed_weathered_copper",
    "minecraft:waxed_weathered_copper_bulb",
    "minecraft:waxed_weathered_copper_door",
    "minecraft:waxed_weathered_copper_grate",
    "minecraft:waxed_weathered_copper_trapdoor",
    "minecraft:waxed_weathered_cut_copper",
    "minecraft:waxed_weathered_cut_copper_slab",
    "minecraft:waxed_weathered_cut_copper_stairs",
    "minecraft:waxed_weathered_double_cut_copper_slab",
    "minecraft:weathered_chiseled_copper",
    "minecraft:weathered_copper",
    "minecraft:weathered_copper_bulb",
    "minecraft:weathered_copper_door",
    "minecraft:weathered_copper_grate",
    "minecraft:weathered_copper_trapdoor",
    "minecraft:weathered_cut_copper",
    "minecraft:weathered_cut_copper_slab",
    "minecraft:weathered_cut_copper_stairs",
    "minecraft:weathered_double_cut_copper_slab",
    "minecraft:white_concrete",
    "minecraft:white_glazed_terracotta",
    "minecraft:white_shulker_box",
    "minecraft:white_terracotta",
    "minecraft:yellow_concrete",
    "minecraft:yellow_glazed_terracotta",
    "minecraft:yellow_shulker_box",
    "minecraft:yellow_terracotta"
  ]
  const customShovels = [
    "nicothekid:brass_shovel",
    "nicothekid:bronze_shovel",
    "nicothekid:olivine_shovel",
    "nicothekid:tin_shovel",
    "nicothekid:zinc_shovel"
  ]
  const shovelDiggableBlocks = [
    "minecraft:black_concrete_powder",
    "minecraft:blue_concrete_powder",
    "minecraft:brown_concrete_powder",
    "minecraft:clay",
    "minecraft:concrete_powder", // old name
    "minecraft:cyan_concrete_powder",
    "minecraft:dirt",
    "minecraft:dirt_with_roots",
    "minecraft:farmland",
    "minecraft:grass_block",
    "minecraft:grass_path",
    "minecraft:gravel",
    "minecraft:gray_concrete_powder",
    "minecraft:green_concrete_powder",
    "minecraft:light_blue_concrete_powder",
    "minecraft:light_gray_concrete_powder",
    "minecraft:lime_concrete_powder",
    "minecraft:magenta_concrete_powder",
    "minecraft:mud",
    "minecraft:muddy_mangrove_roots",
    "minecraft:mycelium",
    "minecraft:orange_concrete_powder",
    "minecraft:pink_concrete_powder",
    "minecraft:podzol",
    "minecraft:purple_concrete_powder",
    "minecraft:red_concrete_powder",
    "minecraft:sand",
    "minecraft:snow",
    "minecraft:snow_layer",
    "minecraft:soul_sand",
    "minecraft:soul_soil",
    "minecraft:suspicious_gravel",
    "minecraft:suspicious_sand",
    "minecraft:white_concrete_powder",
    "minecraft:yellow_concrete_powder"
  ]
  const customSwords = [
    "nicothekid:brass_sword",
    "nicothekid:bronze_sword",
    "nicothekid:olivine_sword",
    "nicothekid:tin_sword",
    "nicothekid:zinc_sword"
  ]
  const swordDiggableBlocks = [
    "minecraft:infested_deepslate",
    "minecraft:monster_egg",
    "minecraft:web"
  ]
  if (itemUsed === undefined || player.matches({ gameMode: GameMode.creative })) return;
  if (customAxes.includes(itemUsed.typeId) || customHoes.includes(itemUsed.typeId) || customPickaxes.includes(itemUsed.typeId) || customShovels.includes(itemUsed.typeId) || customSwords.includes(itemUsed.typeId)) {
    if (!instantDiggableBlocks.includes(brokenBlock.type.id) && !brokenBlock.hasTag("instant_diggable")) {
      if (customAxes.includes(itemUsed.typeId)) {
        const itemEnchantable = itemUsed.getComponent("enchantable");
        const unbreakingLevel = itemEnchantable?.getEnchantment("unbreaking")?.level ?? 0;
        const breakChance = 100 / (unbreakingLevel + 1);
        const randomizeChance = Math.random() * 100;
        if (breakChance < randomizeChance) return;
        const itemDurability = itemUsed.getComponent("durability");
        if (!itemDurability) return;
        const itemMaxDurability = itemDurability.maxDurability;
        const itemDurabilityDamage = itemDurability.damage;
        const durabilityCalculation = itemMaxDurability - itemDurabilityDamage;
        let damageAmount = 0;
        if (axeDiggableBlocks.includes(brokenBlock.type.id) || brokenBlock.hasTag("axe_diggable") || brokenBlock.hasTag("wood")) {
          damageAmount = 1;
        }
        else {
          damageAmount = 2;
        };
        const currentDurability = durabilityCalculation - damageAmount;
        if (currentDurability <= 0) {
          player.playSound("random.break", { pitch: 0.9, location: player.location, volume: 1 });
          playerEquippable.setEquipment("Mainhand", null);
        }
        else {
          itemDurability.damage += damageAmount;
          playerEquippable.setEquipment("Mainhand", itemUsed)
        }
      }
      if (customHoes.includes(itemUsed.typeId)) {
        const itemEnchantable = itemUsed.getComponent("enchantable");
        const unbreakingLevel = itemEnchantable?.getEnchantment("unbreaking")?.level ?? 0;
        const breakChance = 100 / (unbreakingLevel + 1);
        const randomizeChance = Math.random() * 100;
        if (breakChance < randomizeChance) return;
        const itemDurability = itemUsed.getComponent("durability");
        if (!itemDurability) return;
        const itemMaxDurability = itemDurability.maxDurability;
        const itemDurabilityDamage = itemDurability.damage;
        const durabilityCalculation = itemMaxDurability - itemDurabilityDamage;
        let damageAmount = 0;
        if (hoeDiggableBlocks.includes(brokenBlock.type.id) || brokenBlock.hasTag("hoe_diggable") || brokenBlock.hasTag("leaves")) {
          damageAmount = 1;
        }
        else {
          damageAmount = 2;
        };
        const currentDurability = durabilityCalculation - damageAmount;
        if (currentDurability <= 0) {
          player.playSound("random.break", { pitch: 0.9, location: player.location, volume: 1 });
          playerEquippable.setEquipment("Mainhand", null);
        }
        else {
          itemDurability.damage += damageAmount;
          playerEquippable.setEquipment("Mainhand", itemUsed)
        }
      }
      if (customPickaxes.includes(itemUsed.typeId)) {
        const itemEnchantable = itemUsed.getComponent("enchantable");
        const unbreakingLevel = itemEnchantable?.getEnchantment("unbreaking")?.level ?? 0;
        const breakChance = 100 / (unbreakingLevel + 1);
        const randomizeChance = Math.random() * 100;
        if (breakChance < randomizeChance) return;
        const itemDurability = itemUsed.getComponent("durability");
        if (!itemDurability) return;
        const itemMaxDurability = itemDurability.maxDurability;
        const itemDurabilityDamage = itemDurability.damage;
        const durabilityCalculation = itemMaxDurability - itemDurabilityDamage;
        let damageAmount = 0;
        if (pickaxeDiggableBlocks.includes(brokenBlock.type.id) || brokenBlock.hasTag("pickaxe_diggable") || brokenBlock.hasTag("stone")) {
          damageAmount = 1;
        }
        else {
          damageAmount = 2;
        };
        const currentDurability = durabilityCalculation - damageAmount;
        if (currentDurability <= 0) {
          player.playSound("random.break", { pitch: 0.9, location: player.location, volume: 1 });
          playerEquippable.setEquipment("Mainhand", null);
        }
        else {
          itemDurability.damage += damageAmount;
          playerEquippable.setEquipment("Mainhand", itemUsed)
        }
      }
      if (customShovels.includes(itemUsed.typeId)) {
        const itemEnchantable = itemUsed.getComponent("enchantable");
        const unbreakingLevel = itemEnchantable?.getEnchantment("unbreaking")?.level ?? 0;
        const breakChance = 100 / (unbreakingLevel + 1);
        const randomizeChance = Math.random() * 100;
        if (breakChance < randomizeChance) return;
        const itemDurability = itemUsed.getComponent("durability");
        if (!itemDurability) return;
        const itemMaxDurability = itemDurability.maxDurability;
        const itemDurabilityDamage = itemDurability.damage;
        const durabilityCalculation = itemMaxDurability - itemDurabilityDamage;
        let damageAmount = 0;
        if (shovelDiggableBlocks.includes(brokenBlock.type.id) || brokenBlock.hasTag("shovel_diggable") || brokenBlock.hasTag("dirt")) {
          damageAmount = 1;
        }
        else {
          damageAmount = 2;
        };
        const currentDurability = durabilityCalculation - damageAmount;
        if (currentDurability <= 0) {
          player.playSound("random.break", { pitch: 0.9, location: player.location, volume: 1 });
          playerEquippable.setEquipment("Mainhand", null);
        }
        else {
          itemDurability.damage += damageAmount;
          playerEquippable.setEquipment("Mainhand", itemUsed)
        }
      }
      if (customSwords.includes(itemUsed.typeId)) {
        const itemEnchantable = itemUsed.getComponent("enchantable");
        const unbreakingLevel = itemEnchantable?.getEnchantment("unbreaking")?.level ?? 0;
        const breakChance = 100 / (unbreakingLevel + 1);
        const randomizeChance = Math.random() * 100;
        if (breakChance < randomizeChance) return;
        const itemDurability = itemUsed.getComponent("durability");
        if (!itemDurability) return;
        const itemMaxDurability = itemDurability.maxDurability;
        const itemDurabilityDamage = itemDurability.damage;
        const durabilityCalculation = itemMaxDurability - itemDurabilityDamage;
        let damageAmount = 0;
        if (swordDiggableBlocks.includes(brokenBlock.type.id) || brokenBlock.hasTag("sword_diggable")) {
          damageAmount = 1;
        }
        else {
          damageAmount = 2;
        };
        const currentDurability = durabilityCalculation - damageAmount;
        if (currentDurability <= 0) {
          player.playSound("random.break", { pitch: 0.9, location: player.location, volume: 1 });
          playerEquippable.setEquipment("Mainhand", null);
        }
        else {
          itemDurability.damage += damageAmount;
          playerEquippable.setEquipment("Mainhand", itemUsed)
        }
      }
    }
    else return;
  }
  else return;
});