import { EquipmentSlot, EntityEquippableComponent, system, world, ItemStack, ItemEnchantableComponent, Direction, GameMode, BlockPermutation, ItemDurabilityComponent, TicksPerSecond, EntityDamageCause, EntityInventoryComponent, MolangVariableMap } from '@minecraft/server';
import { ActionFormData } from '@minecraft/server-ui';

function getTaggedItems(tag) {
    return Object.keys(ITEM_DEFINITIONS).filter((v) => ITEM_DEFINITIONS[v].tags.includes(tag));
}
const ITEM_DEFINITIONS = {
    "pod_farm:avocado": {
        color: { r: 134, g: 213, b: 58 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:baked_sweet_potato": { color: { r: 230, g: 145, b: 46 }, tags: [] },
    "pod_farm:banana": {
        color: { r: 232, g: 228, b: 176 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:bean": {
        color: { r: 148, g: 204, b: 124 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:bell_pepper": {
        color: { r: 60, g: 164, b: 68 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:blackberry": {
        color: { r: 45, g: 41, b: 93 },
        tags: ["fruit", "berry", "healthy"],
    },
    "pod_farm:blueberry": {
        color: { r: 59, g: 97, b: 140 },
        tags: ["fruit", "berry", "healthy"],
    },
    "pod_farm:broccoli": {
        color: { r: 150, g: 202, b: 94 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:butter": { color: { r: 192, g: 160, b: 25 }, tags: [] },
    "pod_farm:cauliflower": {
        color: { r: 226, g: 222, b: 187 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:bucket_of_cheese": {
        color: { r: 232, g: 211, b: 48 },
        tags: [],
        convertsTo: "bucket",
    },
    "pod_farm:chili": { color: { r: 167, g: 28, b: 33 }, tags: ["vegetable"] },
    "pod_farm:cooked_corn": { color: { r: 244, g: 236, b: 196 }, tags: [] },
    "pod_farm:cooked_egg": { color: { r: 205, g: 163, b: 21 }, tags: [] },
    "pod_farm:corn": { color: { r: 216, g: 185, b: 52 }, tags: ["vegetable"] },
    "pod_farm:cracked_coconut": { color: { r: 172, g: 148, b: 116 }, tags: [] },
    "pod_farm:cranberry": {
        color: { r: 164, g: 26, b: 31 },
        tags: ["fruit", "berry", "healthy"],
    },
    "pod_farm:cucumber": {
        color: { r: 60, g: 140, b: 68 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:fries": { color: { r: 217, g: 187, b: 39 }, tags: [] },
    "pod_farm:ginger": {
        color: { r: 172, g: 140, b: 76 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:grape": {
        color: { r: 84, g: 44, b: 140 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:hawaiian_pizza": { color: { r: 150, g: 88, b: 61 }, tags: [] },
    "pod_farm:kohlrabi": {
        color: { r: 148, g: 204, b: 124 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:lemon": {
        color: { r: 244, g: 236, b: 196 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:lettuce": {
        color: { r: 100, g: 164, b: 84 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:oat": { color: { r: 246, g: 219, b: 192 }, tags: [] },
    "pod_farm:oat_porridge": {
        color: { r: 191, g: 144, b: 90 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:onion": {
        color: { r: 162, g: 96, b: 27 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:orange": {
        color: { r: 186, g: 94, b: 28 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:pea": {
        color: { r: 131, g: 181, b: 29 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:peach": {
        color: { r: 240, g: 150, b: 86 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:peanut": { color: { r: 178, g: 130, b: 66 }, tags: [] },
    "pod_farm:peanut_butter": {
        color: { r: 182, g: 126, b: 35 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pear": {
        color: { r: 100, g: 165, b: 86 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:pineapple": {
        color: { r: 179, g: 114, b: 34 },
        tags: ["fruit", "healthy"],
    },
    "pod_farm:pizza": { color: { r: 223, g: 193, b: 152 }, tags: [] },
    "pod_farm:popcorn": { color: { r: 239, g: 223, b: 101 }, tags: [] },
    "pod_farm:poutine": { color: { r: 161, g: 132, b: 101 }, tags: [] },
    "pod_farm:raspberry": {
        color: { r: 228, g: 76, b: 84 },
        tags: ["fruit", "berry", "healthy"],
    },
    "pod_farm:rhubarb": {
        color: { r: 224, g: 84, b: 61 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:rice": { color: { r: 244, g: 233, b: 222 }, tags: [] },
    "pod_farm:rice_porridge": {
        color: { r: 196, g: 164, b: 132 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:salad": {
        color: { r: 161, g: 149, b: 93 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:spinach": {
        color: { r: 100, g: 164, b: 84 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:strawberry": {
        color: { r: 228, g: 36, b: 36 },
        tags: ["fruit", "berry", "healthy"],
    },
    "pod_farm:sweet_potato": { color: { r: 224, g: 134, b: 20 }, tags: [] },
    "pod_farm:sweet_potato_fries": { color: { r: 207, g: 124, b: 28 }, tags: [] },
    "pod_farm:tomato": {
        color: { r: 195, g: 37, b: 31 },
        tags: ["healthy", "vegetable"],
    },
    "pod_farm:waffle": { color: { r: 224, g: 178, b: 96 }, tags: [] },
    "pod_farm:avocado_sushi": { color: { r: 54, g: 90, b: 44 }, tags: [] },
    "pod_farm:bell_pepper_sushi": { color: { r: 81, g: 120, b: 32 }, tags: [] },
    "pod_farm:cod_sushi": { color: { r: 230, g: 202, b: 180 }, tags: [] },
    "pod_farm:cucumber_sushi": { color: { r: 43, g: 46, b: 21 }, tags: [] },
    "pod_farm:pufferfish_sushi": {
        color: { r: 229, g: 209, b: 186 },
        tags: ["unhealthy"],
    },
    "pod_farm:salmon_sushi": { color: { r: 236, g: 166, b: 99 }, tags: [] },
    "pod_farm:tropical_fish_sushi": {
        color: { r: 233, g: 205, b: 179 },
        tags: [],
    },
    "pod_farm:chicken_noodle_soup": {
        color: { r: 68, g: 46, b: 9 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:potato_soup": {
        color: { r: 199, g: 181, b: 120 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:sweet_potato_soup": {
        color: { r: 224, g: 134, b: 20 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:tomato_soup": {
        color: { r: 228, g: 80, b: 30 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:vegetable_soup": {
        color: { r: 213, g: 84, b: 41 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:blt": { color: { r: 141, g: 66, b: 32 }, tags: [] },
    "pod_farm:breakfast_sandwich": { color: { r: 131, g: 90, b: 38 }, tags: [] },
    "pod_farm:chicken_sandwich": { color: { r: 180, g: 91, b: 31 }, tags: [] },
    "pod_farm:pb_j_sandwich": { color: { r: 124, g: 81, b: 36 }, tags: [] },
    "pod_farm:pb_j_sandwich1": { color: { r: 247, g: 222, b: 217 }, tags: [] },
    "pod_farm:pb_j_sandwich2": { color: { r: 124, g: 81, b: 36 }, tags: [] },
    "pod_farm:pb_j_sandwich3": { color: { r: 124, g: 81, b: 36 }, tags: [] },
    "pod_farm:pb_j_sandwich4": { color: { r: 246, g: 219, b: 208 }, tags: [] },
    "pod_farm:pb_j_sandwich5": { color: { r: 246, g: 219, b: 208 }, tags: [] },
    "pod_farm:pb_j_sandwich6": { color: { r: 247, g: 222, b: 217 }, tags: [] },
    "pod_farm:pb_j_sandwich7": { color: { r: 246, g: 219, b: 208 }, tags: [] },
    "pod_farm:turkey_sandwich": { color: { r: 137, g: 95, b: 53 }, tags: [] },
    "pod_farm:apple_pie": { color: { r: 155, g: 102, b: 33 }, tags: [] },
    "pod_farm:blackberry_pie": { color: { r: 218, g: 169, b: 83 }, tags: [] },
    "pod_farm:blueberry_pie": { color: { r: 188, g: 112, b: 106 }, tags: [] },
    "pod_farm:grape_pie": { color: { r: 181, g: 107, b: 118 }, tags: [] },
    "pod_farm:peach_pie": { color: { r: 199, g: 146, b: 56 }, tags: [] },
    "pod_farm:raspberry_pie": { color: { r: 199, g: 146, b: 56 }, tags: [] },
    "pod_farm:rhubarb_pie": { color: { r: 226, g: 181, b: 100 }, tags: [] },
    "pod_farm:strawberry_tart": { color: { r: 213, g: 58, b: 36 }, tags: [] },
    "pod_farm:broccoli_cheese_pasta": {
        color: { r: 147, g: 163, b: 68 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:spinach_pasta": {
        color: { r: 224, g: 211, b: 170 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:tomato_chili_pasta": {
        color: { r: 236, g: 132, b: 96 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:tomato_onion_pasta": {
        color: { r: 228, g: 166, b: 123 },
        tags: [],
        convertsTo: "bowl",
    },
    "pod_farm:bison_raw": { color: { r: 80, g: 16, b: 8 }, tags: [] },
    "pod_farm:duck_raw": { color: { r: 152, g: 100, b: 81 }, tags: [] },
    "pod_farm:goose_raw": { color: { r: 201, g: 153, b: 135 }, tags: [] },
    "pod_farm:turkey_raw": { color: { r: 155, g: 103, b: 83 }, tags: [] },
    "pod_farm:venison_raw": { color: { r: 171, g: 45, b: 29 }, tags: [] },
    "pod_farm:yak_raw": { color: { r: 75, g: 15, b: 7 }, tags: [] },
    "pod_farm:grilled_beef": { color: { r: 60, g: 30, b: 20 }, tags: [] },
    "pod_farm:grilled_bison": { color: { r: 137, g: 82, b: 58 }, tags: [] },
    "pod_farm:grilled_chicken": { color: { r: 220, g: 156, b: 124 }, tags: [] },
    "pod_farm:grilled_cod": { color: { r: 169, g: 132, b: 92 }, tags: [] },
    "pod_farm:grilled_duck": { color: { r: 204, g: 124, b: 76 }, tags: [] },
    "pod_farm:grilled_goose": { color: { r: 223, g: 169, b: 141 }, tags: [] },
    "pod_farm:grilled_mutton": { color: { r: 150, g: 96, b: 74 }, tags: [] },
    "pod_farm:grilled_porkchop": { color: { r: 211, g: 193, b: 143 }, tags: [] },
    "pod_farm:grilled_rabbit": { color: { r: 110, g: 53, b: 25 }, tags: [] },
    "pod_farm:grilled_salmon": { color: { r: 87, g: 67, b: 48 }, tags: [] },
    "pod_farm:grilled_turkey": { color: { r: 161, g: 84, b: 46 }, tags: [] },
    "pod_farm:grilled_venison": { color: { r: 65, g: 31, b: 22 }, tags: [] },
    "pod_farm:grilled_yak": { color: { r: 137, g: 82, b: 58 }, tags: [] },
    "pod_farm:bison_cooked": { color: { r: 137, g: 82, b: 58 }, tags: [] },
    "pod_farm:duck_cooked": { color: { r: 204, g: 124, b: 76 }, tags: [] },
    "pod_farm:goose_cooked": { color: { r: 223, g: 169, b: 141 }, tags: [] },
    "pod_farm:turkey_cooked": { color: { r: 161, g: 84, b: 46 }, tags: [] },
    "pod_farm:venison_cooked": { color: { r: 65, g: 31, b: 22 }, tags: [] },
    "pod_farm:yak_cooked": { color: { r: 137, g: 82, b: 58 }, tags: [] },
    "pod_farm:blackberry_jam": {
        color: { r: 35, g: 7, b: 14 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:blueberry_jam": {
        color: { r: 152, g: 46, b: 90 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:chili_jam": {
        color: { r: 220, g: 76, b: 60 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:grape_jam": {
        color: { r: 142, g: 46, b: 152 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:marmalade": {
        color: { r: 217, g: 133, b: 36 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:peach_jam": {
        color: { r: 173, g: 64, b: 23 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:raspberry_jam": {
        color: { r: 95, g: 6, b: 22 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:strawberry_jam": {
        color: { r: 116, g: 12, b: 12 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:apple_ice_cream": { color: { r: 242, g: 188, b: 138 }, tags: [] },
    "pod_farm:banana_ice_cream": { color: { r: 231, g: 215, b: 191 }, tags: [] },
    "pod_farm:blackberry_ice_cream": {
        color: { r: 212, g: 85, b: 154 },
        tags: [],
    },
    "pod_farm:blueberry_ice_cream": {
        color: { r: 188, g: 84, b: 164 },
        tags: [],
    },
    "pod_farm:chocolate_ice_cream": { color: { r: 149, g: 99, b: 59 }, tags: [] },
    "pod_farm:cranberry_ice_cream": {
        color: { r: 244, g: 177, b: 177 },
        tags: [],
    },
    "pod_farm:ice_cream_cone": { color: { r: 145, g: 101, b: 69 }, tags: [] },
    "pod_farm:lemon_ice_cream": { color: { r: 220, g: 204, b: 92 }, tags: [] },
    "pod_farm:peach_ice_cream": { color: { r: 212, g: 188, b: 124 }, tags: [] },
    "pod_farm:pineapple_ice_cream": {
        color: { r: 244, g: 219, b: 149 },
        tags: [],
    },
    "pod_farm:raspberry_ice_cream": {
        color: { r: 231, g: 129, b: 157 },
        tags: [],
    },
    "pod_farm:strawberry_ice_cream": {
        color: { r: 240, g: 147, b: 149 },
        tags: [],
    },
    "pod_farm:vanillla_ice_cream": {
        color: { r: 212, g: 188, b: 148 },
        tags: [],
    },
    "pod_farm:cup_of_coffee": {
        color: { r: 146, g: 66, b: 40 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:cup_of_ginger_tea": {
        color: { r: 214, g: 178, b: 108 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:cup_of_hot_chocolate": {
        color: { r: 177, g: 81, b: 50 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:cup_of_tea": {
        color: { r: 107, g: 113, b: 57 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:gravy": {
        color: { r: 165, g: 103, b: 75 },
        tags: [],
        convertsTo: "bucket",
    },
    "pod_farm:oat_milk": {
        color: { r: 227, g: 211, b: 196 },
        tags: [],
        convertsTo: "bucket",
    },
    "pod_farm:apple_juice": {
        color: { r: 196, g: 148, b: 20 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:blackberry_juice": {
        color: { r: 113, g: 9, b: 69 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:blueberry_juice": {
        color: { r: 191, g: 34, b: 141 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:carrot_juice": {
        color: { r: 248, g: 153, b: 30 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:cranberry_juice": {
        color: { r: 215, g: 25, b: 32 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:golden_apple_juice": {
        color: { r: 239, g: 200, b: 7 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:grape_juice": {
        color: { r: 153, g: 23, b: 73 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:lemonade": {
        color: { r: 255, g: 215, b: 76 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:orange_juice": {
        color: { r: 248, g: 153, b: 30 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pear_juice": {
        color: { r: 224, g: 157, b: 63 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pineapple_juice": {
        color: { r: 245, g: 198, b: 28 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:raspberry_juice": {
        color: { r: 245, g: 29, b: 0 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:strawberry_juice": {
        color: { r: 245, g: 54, b: 24 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:tomato_juice": {
        color: { r: 252, g: 92, b: 28 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:cheeseburger": { color: { r: 98, g: 81, b: 28 }, tags: [] },
    "pod_farm:fish_burger": { color: { r: 147, g: 102, b: 36 }, tags: [] },
    "pod_farm:hamburger": { color: { r: 67, g: 45, b: 16 }, tags: [] },
    "pod_farm:poultry_burger": { color: { r: 140, g: 90, b: 29 }, tags: [] },
    "pod_farm:avocado_toast": { color: { r: 155, g: 110, b: 44 }, tags: [] },
    "pod_farm:baguette": { color: { r: 188, g: 137, b: 39 }, tags: [] },
    "pod_farm:blackberry_jam_toast": { color: { r: 53, g: 9, b: 22 }, tags: [] },
    "pod_farm:blueberry_jam_toast": { color: { r: 128, g: 59, b: 53 }, tags: [] },
    "pod_farm:bread_slice": { color: { r: 236, g: 188, b: 124 }, tags: [] },
    "pod_farm:buttered_toast": { color: { r: 245, g: 220, b: 121 }, tags: [] },
    "pod_farm:chili_jam_toast": { color: { r: 142, g: 65, b: 31 }, tags: [] },
    "pod_farm:corn_bread": { color: { r: 207, g: 161, b: 46 }, tags: [] },
    "pod_farm:gingerbread": { color: { r: 172, g: 92, b: 52 }, tags: [] },
    "pod_farm:grape_jam_toast": { color: { r: 66, g: 9, b: 72 }, tags: [] },
    "pod_farm:honey_toast": { color: { r: 171, g: 118, b: 42 }, tags: [] },
    "pod_farm:marmalade_toast": { color: { r: 171, g: 112, b: 42 }, tags: [] },
    "pod_farm:peach_jam_toast": { color: { r: 171, g: 106, b: 42 }, tags: [] },
    "pod_farm:peanut_butter_toast": {
        color: { r: 201, g: 149, b: 61 },
        tags: [],
    },
    "pod_farm:raspberry_jam_toast": {
        color: { r: 207, g: 78, b: 105 },
        tags: [],
    },
    "pod_farm:strawberry_jam_toast": {
        color: { r: 186, g: 116, b: 65 },
        tags: [],
    },
    "pod_farm:tomato_sauce": {
        color: { r: 204, g: 52, b: 18 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "pod_farm:vanilla": {
        color: { r: 173, g: 148, b: 119 },
        tags: [],
    },
    "pod_farm:tea": {
        color: { r: 143, g: 195, b: 36 },
        tags: [],
    },
    "pod_farm:pea_seeds": {
        color: { r: 185, g: 230, b: 93 },
        tags: [],
    },
    "pod_farm:coffee_plant_seeds": {
        color: { r: 168, g: 55, b: 40 },
        tags: [],
    },
    "pod_farm:coffee": {
        color: { r: 129, g: 69, b: 31 },
        tags: [],
    },
    "pod_farm:pasta": {
        color: { r: 229, g: 187, b: 81 },
        tags: [],
    },
    "pod_farm:fruity_ice_cream": { color: { r: 226, g: 215, b: 165 }, tags: [] },
    "pod_farm:suspicious_ice_cream": {
        color: { r: 130, g: 216, b: 117 },
        tags: [],
    },
    "pod_farm:unhealthy_ice_cream": { color: { r: 76, g: 49, b: 25 }, tags: [] },
    "pod_farm:apple_banana_smoothie": {
        color: { r: 221, g: 221, b: 140 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:avocado_peach_smoothie": {
        color: { r: 173, g: 153, b: 63 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_banana_smoothie": {
        color: { r: 218, g: 199, b: 157 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_beet_smoothie": {
        color: { r: 150, g: 7, b: 40 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_citrus_smoothie": {
        color: { r: 239, g: 205, b: 75 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_smoothie": {
        color: { r: 206, g: 112, b: 151 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:blueberry_ginger_smoothie": {
        color: { r: 185, g: 105, b: 112 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:carrot_ginger_smoothie": {
        color: { r: 214, g: 118, b: 20 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:green_detox_smoothie": {
        color: { r: 160, g: 201, b: 101 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:healthy_smoothie": {
        color: { r: 38, g: 139, b: 39 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:peachy_green_smoothie": {
        color: { r: 140, g: 196, b: 86 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:peanut_butter_banana_smoothie": {
        color: { r: 222, g: 183, b: 94 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pineapple_coconut_smoothie": {
        color: { r: 245, g: 229, b: 168 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:suspicious_smoothie": {
        color: { r: 218, g: 133, b: 202 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:tropical_carrot_smoothie": {
        color: { r: 219, g: 123, b: 20 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:tropical_green_smoothie": {
        color: { r: 122, g: 184, b: 64 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:tropical_smoothie": {
        color: { r: 243, g: 108, b: 124 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:unhealthy_smoothie": {
        color: { r: 73, g: 89, b: 31 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:peanut_butter_banana_milkshake": {
        color: { r: 234, g: 206, b: 154 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_banana_milkshake": {
        color: { r: 240, g: 239, b: 204 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_coconut_milkshake": {
        color: { r: 213, g: 216, b: 227 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_ginger_milkshake": {
        color: { r: 190, g: 193, b: 213 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_milkshake": {
        color: { r: 192, g: 190, b: 215 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:berry_rhubarb_milkshake": {
        color: { r: 187, g: 183, b: 207 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:chocolate_banana_milkshake": {
        color: { r: 175, g: 119, b: 67 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:chocolate_cookie_milkshake": {
        color: { r: 143, g: 88, b: 46 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:chocolate_milkshake": {
        color: { r: 143, g: 88, b: 46 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:chocolate_peanut_milkshake": {
        color: { r: 120, g: 73, b: 19 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:citrus_milkshake": {
        color: { r: 222, g: 204, b: 68 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:coffee_banana_milkshake": {
        color: { r: 165, g: 130, b: 92 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:coffee_vanilla_milkshake": {
        color: { r: 220, g: 207, b: 170 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:ginger_peach_milkshake": {
        color: { r: 255, g: 185, b: 139 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:healthy_milkshake": {
        color: { r: 135, g: 184, b: 136 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:peach_honey_milkshake": {
        color: { r: 238, g: 136, b: 60 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:peach_melon_milkshake": {
        color: { r: 171, g: 98, b: 43 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pineapple_coconut_milkshake": {
        color: { r: 221, g: 236, b: 227 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:pineapple_ginger_milkshake": {
        color: { r: 234, g: 189, b: 54 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:suspicious_milkshake": {
        color: { r: 222, g: 198, b: 233 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:tropical_milkshake": {
        color: { r: 246, g: 190, b: 196 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:unhealthy_milkshake": {
        color: { r: 112, g: 130, b: 65 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:vanilla_berry_milkshake": {
        color: { r: 206, g: 211, b: 201 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "pod_farm:vanilla_milkshake": {
        color: { r: 213, g: 220, b: 213 },
        tags: [],
        convertsTo: "glass_bottle",
    },
    "minecraft:water_bucket": {
        color: { r: 68, g: 111, b: 233 },
        tags: [],
        convertsTo: "bucket",
    },
    "minecraft:milk_bucket": {
        color: { r: 255, g: 255, b: 255 },
        tags: [],
        convertsTo: "bucket",
    },
    "minecraft:sweet_berries": {
        color: { r: 165, g: 7, b: 0 },
        tags: ["fruit", "berry", "healthy"],
    },
    "minecraft:cocoa_beans": {
        color: { r: 112, g: 68, b: 37 },
        tags: [],
    },
    "minecraft:brown_mushroom": {
        color: { r: 204, g: 153, b: 120 },
        tags: [],
    },
    "minecraft:red_mushroom": {
        color: { r: 236, g: 210, b: 158 },
        tags: [],
    },
    "minecraft:chicken": {
        color: { r: 242, g: 201, b: 189 },
        tags: [],
    },
    "minecraft:mutton": {
        color: { r: 221, g: 56, b: 48 },
        tags: [],
    },
    "minecraft:rabbit": {
        color: { r: 254, g: 229, b: 210 },
        tags: [],
    },
    "minecraft:dried_kelp": {
        color: { r: 97, g: 92, b: 80 },
        tags: [],
    },
    "minecraft:pumpkin_pie": {
        color: { r: 234, g: 158, b: 96 },
        tags: [],
    },
    "minecraft:cooked_rabbit": {
        color: { r: 231, g: 191, b: 162 },
        tags: [],
    },
    "minecraft:cookie": {
        color: { r: 217, g: 131, b: 62 },
        tags: [],
    },
    "minecraft:cooked_beef": {
        color: { r: 142, g: 82, b: 60 },
        tags: [],
    },
    "minecraft:baked_potato": {
        color: { r: 200, g: 151, b: 58 },
        tags: [],
    },
    "minecraft:cooked_mutton": {
        color: { r: 136, g: 79, b: 64 },
        tags: [],
    },
    "minecraft:rabbit_stew": {
        color: { r: 255, g: 142, b: 9 },
        tags: [],
        convertsTo: "minecraft:bowl",
    },
    "minecraft:cooked_porkchop": {
        color: { r: 211, g: 192, b: 136 },
        tags: [],
    },
    "minecraft:porkchop": {
        color: { r: 255, g: 119, b: 119 },
        tags: [],
    },
    "minecraft:cooked_chicken": {
        color: { r: 205, g: 125, b: 74 },
        tags: [],
    },
    "minecraft:beef": {
        color: { r: 224, g: 62, b: 53 },
        tags: [],
    },
    "minecraft:sugar": {
        color: { r: 213, g: 213, b: 213 },
        tags: [],
    },
    "minecraft:rotten_flesh": {
        color: { r: 111, g: 77, b: 27 },
        tags: ["unhealthy"],
    },
    "minecraft:mushroom_stew": {
        color: { r: 205, g: 140, b: 111 },
        tags: ["healthy"],
        convertsTo: "minecraft:bowl",
    },
    "minecraft:beetroot_soup": {
        color: { r: 132, g: 22, b: 13 },
        tags: ["healthy"],
        convertsTo: "minecraft:bowl",
    },
    "minecraft:beetroot": {
        color: { r: 164, g: 39, b: 44 },
        tags: ["vegetable", "healthy"],
    },
    "minecraft:potato": {
        color: { r: 217, g: 170, b: 81 },
        tags: ["vegetable", "healthy"],
    },
    "minecraft:carrot": {
        color: { r: 255, g: 142, b: 9 },
        tags: ["vegetable", "healthy"],
    },
    "minecraft:apple": {
        color: { r: 255, g: 28, b: 43 },
        tags: ["fruit", "healthy"],
    },
    "minecraft:golden_apple": {
        color: { r: 236, g: 203, b: 69 },
        tags: ["fruit", "healthy"],
    },
    "minecraft:melon_slice": {
        color: { r: 191, g: 49, b: 35 },
        tags: ["fruit", "healthy"],
    },
    "minecraft:enchanted_golden_apple": {
        color: { r: 250, g: 206, b: 104 },
        tags: ["fruit", "healthy"],
    },
    "minecraft:golden_carrot": {
        color: { r: 236, g: 203, b: 60 },
        tags: ["vegetable", "healthy"],
    },
    "minecraft:snowball": {
        color: { r: 208, g: 241, b: 241 },
        tags: [],
    },
    "minecraft:honey_bottle": {
        color: { r: 255, g: 145, b: 22 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "minecraft:potion": {
        color: { r: 55, g: 92, b: 196 },
        tags: [],
        convertsTo: "minecraft:glass_bottle",
    },
    "minecraft:bread": {
        color: { r: 188, g: 137, b: 39 },
        tags: [],
    },
};

const ICE_CREAM = [
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "minecraft:apple" },
        ],
        result: [{ item: "pod_farm:apple_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:banana" },
        ],
        result: [{ item: "pod_farm:banana_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:blueberry" },
        ],
        result: [{ item: "pod_farm:blueberry_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:blackberry" },
        ],
        result: [{ item: "pod_farm:blackberry_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "minecraft:cocoa_beans" },
        ],
        result: [{ item: "pod_farm:chocolate_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:cranberry" },
        ],
        result: [{ item: "pod_farm:cranberry_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:lemon" },
        ],
        result: [{ item: "pod_farm:lemon_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:peach" },
        ],
        result: [{ item: "pod_farm:peach_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:pineapple" },
        ],
        result: [{ item: "pod_farm:pineapple_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:raspberry" },
        ],
        result: [{ item: "pod_farm:raspberry_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:strawberry" },
        ],
        result: [{ item: "pod_farm:strawberry_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
    {
        cooking_blocks: ["blender", "crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            { item: "minecraft:snowball" },
            { item: "minecraft:sugar" },
            { item: "pod_farm:vanilla" },
        ],
        result: [{ item: "pod_farm:vanillla_ice_cream" }],
        data: { container: "pod_farm:ice_cream_cone" },
    },
];
const SMOOTHIES = [
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:spinach" }],
        result: [{ item: "pod_farm:tropical_green_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:avocado" },
                    { item: "pod_farm:banana" },
                    { item: "pod_farm:pineapple" },
                    { item: "pod_farm:cracked_coconut" },
                    { item: "pod_farm:lemon" },
                ],
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "minecraft:beetroot" }],
        result: [{ item: "pod_farm:berry_beet_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:ginger" }, { item: "minecraft:carrot" }],
        result: [{ item: "pod_farm:carrot_ginger_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:lemon" },
                    { item: "pod_farm:orange" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:avocado" }, { item: "pod_farm:peach" }],
        result: [{ item: "pod_farm:avocado_peach_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:spinach" },
                    { item: "pod_farm:banana" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [
            { item: "pod_farm:pineapple" },
            { item: "pod_farm:cracked_coconut" },
        ],
        result: [{ item: "pod_farm:pineapple_coconut_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:spinach" },
                    { item: "pod_farm:banana" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:banana" }],
        result: [{ item: "pod_farm:berry_banana_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [
            { item: "pod_farm:spinach" },
            { item: "pod_farm:cucumber" },
            { item: "pod_farm:ginger" },
        ],
        result: [{ item: "pod_farm:green_detox_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "minecraft:apple" },
                    { item: "pod_farm:lemon" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [
            { item: "pod_farm:peanut_butter" },
            { item: "pod_farm:banana" },
        ],
        result: [{ item: "pod_farm:peanut_butter_banana_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "minecraft:cocoa_beans" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "minecraft:carrot" }],
        result: [{ item: "pod_farm:tropical_carrot_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:orange" },
                    { item: "pod_farm:banana" },
                    { item: "pod_farm:pineapple" },
                    { item: "pod_farm:cracked_coconut" },
                    { item: "pod_farm:lemon" },
                ],
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:orange" }, { item: "pod_farm:lemon" }],
        result: [{ item: "pod_farm:berry_citrus_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:blueberry" }, { item: "pod_farm:ginger" }],
        result: [{ item: "pod_farm:blueberry_ginger_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:banana" },
                    { item: "pod_farm:spinach" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:peach" }, { item: "pod_farm:spinach" }],
        result: [{ item: "pod_farm:peachy_green_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:banana" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [{ item: "pod_farm:banana" }, { item: "minecraft:apple" }],
        result: [{ item: "pod_farm:apple_banana_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:pear" },
                    { item: "minecraft:honey_bottle" },
                ],
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [],
        result: [{ item: "pod_farm:berry_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [],
        result: [{ item: "pod_farm:healthy_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: getTaggedItems("healthy").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_smoothies",
        ingredients: [],
        result: [{ item: "pod_farm:tropical_smoothie" }],
        data: {
            container: "minecraft:glass_bottle",
            optional: {
                ingredients: [
                    { item: "pod_farm:avocado" },
                    { item: "pod_farm:orange" },
                    { item: "pod_farm:banana" },
                    { item: "pod_farm:pineapple" },
                    { item: "pod_farm:cracked_coconut" },
                    { item: "pod_farm:lemon" },
                ],
                min: 1,
            },
        },
    },
];
const MILKSHAKES = [
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:banana" }],
        result: [{ item: "pod_farm:berry_banana_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:cracked_coconut" }],
        result: [{ item: "pod_farm:berry_coconut_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:vanilla" }],
        result: [{ item: "pod_farm:vanilla_berry_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:ginger" }],
        result: [{ item: "pod_farm:berry_ginger_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:rhubarb" }],
        result: [{ item: "pod_farm:berry_rhubarb_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:peach" },
            { item: "minecraft:honey_bottle" },
        ],
        result: [{ item: "pod_farm:peach_honey_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [{ item: "pod_farm:vanilla" }],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:banana" },
            { item: "pod_farm:peanut_butter" },
        ],
        result: [{ item: "pod_farm:peanut_butter_banana_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:pineapple" },
            { item: "pod_farm:cracked_coconut" },
        ],
        result: [{ item: "pod_farm:pineapple_coconut_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:banana" }, { item: "pod_farm:coffee" }],
        result: [{ item: "pod_farm:coffee_banana_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:vanilla" }, { item: "pod_farm:coffee" }],
        result: [{ item: "pod_farm:coffee_vanilla_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [{ item: "minecraft:honey_bottle" }],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:peach" },
            { item: "minecraft:melon_slice" },
        ],
        result: [{ item: "pod_farm:peach_melon_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:banana" },
            { item: "minecraft:cocoa_beans" },
        ],
        result: [{ item: "pod_farm:chocolate_banana_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:orange" }, { item: "pod_farm:lemon" }],
        result: [{ item: "pod_farm:citrus_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:peach" }, { item: "pod_farm:ginger" }],
        result: [{ item: "pod_farm:ginger_peach_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:pineapple" }, { item: "pod_farm:ginger" }],
        result: [{ item: "pod_farm:pineapple_ginger_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:vanilla" },
                    { item: "minecraft:honey_bottle" },
                ],
                min: 0,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "pod_farm:peanut" },
            { item: "minecraft:cocoa_beans" },
        ],
        result: [{ item: "pod_farm:chocolate_peanut_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [
            { item: "minecraft:cookie" },
            { item: "minecraft:cocoa_beans" },
        ],
        result: [{ item: "pod_farm:chocolate_cookie_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "minecraft:cocoa_beans" }],
        result: [{ item: "pod_farm:chocolate_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [{ item: "pod_farm:vanilla" }],
        result: [{ item: "pod_farm:vanilla_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [],
        result: [{ item: "pod_farm:berry_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("berry").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [],
        result: [{ item: "pod_farm:healthy_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: getTaggedItems("healthy").map((v) => {
                    return { item: v };
                }),
                min: 1,
            },
        },
    },
    {
        cooking_blocks: ["blender"],
        category: "drinks_milkshakes",
        ingredients: [],
        result: [{ item: "pod_farm:tropical_milkshake" }],
        data: {
            container: "minecraft:glass_bottle",
            milk: true,
            optional: {
                ingredients: [
                    { item: "pod_farm:avocado" },
                    { item: "pod_farm:orange" },
                    { item: "pod_farm:banana" },
                    { item: "pod_farm:pineapple" },
                    { item: "pod_farm:cracked_coconut" },
                    { item: "pod_farm:lemon" },
                ],
                min: 1,
            },
        },
    },
];
const JUICES = [
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "minecraft:apple", amount: 2 }],
        result: [{ item: "pod_farm:apple_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:blackberry", amount: 2 }],
        result: [{ item: "pod_farm:blackberry_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:blueberry", amount: 2 }],
        result: [{ item: "pod_farm:blueberry_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "minecraft:carrot", amount: 2 }],
        result: [{ item: "pod_farm:carrot_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:cranberry", amount: 2 }],
        result: [{ item: "pod_farm:cranberry_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "minecraft:golden_apple", amount: 2 }],
        result: [{ item: "pod_farm:golden_apple_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:grape", amount: 2 }],
        result: [{ item: "pod_farm:grape_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:lemon", amount: 2 }],
        result: [{ item: "pod_farm:lemonade" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:orange", amount: 2 }],
        result: [{ item: "pod_farm:orange_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:pear", amount: 2 }],
        result: [{ item: "pod_farm:pear_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:pineapple", amount: 2 }],
        result: [{ item: "pod_farm:pineapple_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:raspberry", amount: 2 }],
        result: [{ item: "pod_farm:raspberry_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:strawberry", amount: 2 }],
        result: [{ item: "pod_farm:strawberry_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["juicer"],
        category: "drinks_juices",
        ingredients: [{ item: "pod_farm:tomato", amount: 2 }],
        result: [{ item: "pod_farm:tomato_juice" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
];
const COOKING_POT = [
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "drinks_misc",
        ingredients: [
            {
                item: "minecraft:water_bucket",
            },
            {
                item: "pod_farm:oat",
                amount: 3,
            },
        ],
        result: [{ item: "pod_farm:oat_milk" }],
        data: { container: "minecraft:bucket" },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_misc",
        ingredients: [
            {
                item: "pod_farm:oat",
            },
            {
                item: "pod_farm:oat_milk",
            },
        ],
        result: [{ item: "pod_farm:oat_porridge" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_misc",
        ingredients: [
            {
                item: "pod_farm:oat",
            },
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:oat_porridge" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_misc",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "pod_farm:oat_milk",
            },
        ],
        result: [{ item: "pod_farm:rice_porridge" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_misc",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:rice_porridge" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_misc",
        ingredients: [
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:tomato_sauce" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pot"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:bucket_of_cheese" }],
        data: {
            container: "minecraft:bucket",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "minecraft:water_bucket",
            },
            {
                item: "minecraft:cooked_chicken",
            },
            {
                item: "minecraft:cooked_beef",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "pod_farm:onion",
            },
        ],
        result: [{ item: "pod_farm:gravy" }],
        data: {
            container: "minecraft:bucket",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:cooked_chicken",
            },
            {
                item: "pod_farm:pasta",
            },
        ],
        result: [{ item: "pod_farm:chicken_noodle_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:potato",
            },
            {
                item: "pod_farm:bean",
            },
        ],
        result: [{ item: "pod_farm:potato_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "pod_farm:pea_seeds",
            },
            {
                item: "pod_farm:sweet_potato",
            },
        ],
        result: [{ item: "pod_farm:sweet_potato_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "pod_farm:tomato",
            },
            {
                item: "pod_farm:bell_pepper",
            },
            {
                item: "pod_farm:onion",
            },
        ],
        result: [{ item: "pod_farm:tomato_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "pod_farm:kohlrabi",
            },
            {
                item: "pod_farm:cauliflower",
            },
            {
                item: "pod_farm:pea_seeds",
            },
        ],
        result: [{ item: "pod_farm:vegetable_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:blackberry",
            },
        ],
        result: [{ item: "pod_farm:blackberry_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:blueberry",
            },
        ],
        result: [{ item: "pod_farm:blueberry_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:chili",
            },
        ],
        result: [{ item: "pod_farm:chili_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:grape",
            },
        ],
        result: [{ item: "pod_farm:grape_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:orange",
            },
        ],
        result: [{ item: "pod_farm:marmalade" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:peach",
            },
        ],
        result: [{ item: "pod_farm:peach_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:raspberry",
            },
        ],
        result: [{ item: "pod_farm:raspberry_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:strawberry",
            },
        ],
        result: [{ item: "pod_farm:strawberry_jam" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_pasta",
        ingredients: [
            {
                item: "pod_farm:broccoli",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
            {
                item: "pod_farm:pasta",
            },
        ],
        result: [{ item: "pod_farm:broccoli_cheese_pasta" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_pasta",
        ingredients: [
            {
                item: "pod_farm:spinach",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
            {
                item: "pod_farm:pasta",
            },
        ],
        result: [{ item: "pod_farm:spinach_pasta" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_pasta",
        ingredients: [
            {
                item: "pod_farm:tomato_sauce",
            },
            {
                item: "pod_farm:chili",
            },
            {
                item: "pod_farm:pasta",
            },
        ],
        result: [{ item: "pod_farm:tomato_chili_pasta" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_pasta",
        ingredients: [
            {
                item: "pod_farm:tomato_sauce",
            },
            {
                item: "pod_farm:onion",
            },
            {
                item: "pod_farm:pasta",
            },
        ],
        result: [{ item: "pod_farm:tomato_onion_pasta" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:beetroot",
                amount: 6,
            },
        ],
        result: [{ item: "minecraft:beetroot_soup" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:brown_mushroom",
            },
            {
                item: "minecraft:red_mushroom",
            },
        ],
        result: [{ item: "minecraft:mushroom_stew" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:cooked_rabbit",
            },
            {
                item: "minecraft:carrot",
            },
            {
                item: "minecraft:baked_potato",
            },
            {
                item: "minecraft:red_mushroom",
            },
        ],
        result: [{ item: "minecraft:rabbit_stew" }],
        data: {
            container: "minecraft:bowl",
        },
    },
    {
        cooking_blocks: ["cooking_pot", "crafting_table"],
        category: "bowls_soup",
        ingredients: [
            {
                item: "minecraft:cooked_rabbit",
            },
            {
                item: "minecraft:carrot",
            },
            {
                item: "minecraft:baked_potato",
            },
            {
                item: "minecraft:brown_mushroom",
            },
        ],
        result: [{ item: "minecraft:rabbit_stew" }],
        data: {
            container: "minecraft:bowl",
        },
    },
];
const KETTLE = [
    {
        cooking_blocks: ["kettle", "brewing_stand"],
        category: "drinks_misc",
        ingredients: [
            {
                item: "pod_farm:coffee",
            },
            {
                item: "minecraft:potion",
            },
        ],
        result: [{ item: "pod_farm:cup_of_coffee" }],
        data: {
            container: "minecraft:glass_bottle",
            key: "coffee",
        },
    },
    {
        cooking_blocks: ["kettle", "brewing_stand"],
        category: "drinks_misc",
        ingredients: [
            {
                item: "minecraft:cocoa_beans",
            },
            {
                item: "minecraft:potion",
            },
        ],
        result: [{ item: "pod_farm:cup_of_hot_chocolate" }],
        data: {
            container: "minecraft:glass_bottle",
            key: "cocoa_beans",
        },
    },
    {
        cooking_blocks: ["kettle", "brewing_stand"],
        category: "drinks_misc",
        ingredients: [
            {
                item: "pod_farm:tea",
            },
            {
                item: "minecraft:potion",
            },
        ],
        result: [{ item: "pod_farm:cup_of_tea" }],
        data: {
            container: "minecraft:glass_bottle",
            key: "tea",
        },
    },
    {
        cooking_blocks: ["kettle", "brewing_stand"],
        category: "drinks_misc",
        ingredients: [
            {
                item: "pod_farm:ginger",
            },
            {
                item: "minecraft:potion",
            },
        ],
        result: [{ item: "pod_farm:cup_of_ginger_tea" }],
        data: {
            container: "minecraft:glass_bottle",
            key: "ginger",
        },
    },
];
const COOKED = [
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:beef",
            },
        ],
        result: [{ item: "minecraft:cooked_beef" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:chicken",
            },
        ],
        result: [{ item: "minecraft:cooked_chicken" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:porkchop",
            },
        ],
        result: [{ item: "minecraft:cooked_porkchop" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:mutton",
            },
        ],
        result: [{ item: "minecraft:cooked_mutton" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:rabbit",
            },
        ],
        result: [{ item: "minecraft:cooked_rabbit" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven", "grill"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "minecraft:potato",
            },
        ],
        result: [{ item: "minecraft:baked_potato" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:cod",
            },
        ],
        result: [{ item: "minecraft:cooked_cod" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "minecraft:salmon",
            },
        ],
        result: [{ item: "minecraft:cooked_salmon" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:bison_raw",
            },
        ],
        result: [{ item: "pod_farm:bison_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:venison_raw",
            },
        ],
        result: [{ item: "pod_farm:venison_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:duck_raw",
            },
        ],
        result: [{ item: "pod_farm:duck_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:goose_raw",
            },
        ],
        result: [{ item: "pod_farm:goose_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:turkey_raw",
            },
        ],
        result: [{ item: "pod_farm:turkey_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_meat",
        ingredients: [
            {
                item: "pod_farm:yak_raw",
            },
        ],
        result: [{ item: "pod_farm:yak_cooked" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven", "grill"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "pod_farm:corn",
            },
        ],
        result: [{ item: "pod_farm:cooked_corn" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven", "grill"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "pod_farm:sweet_potato",
            },
        ],
        result: [{ item: "pod_farm:baked_sweet_potato" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:cooked_egg" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "pod_farm:cooked_corn",
            },
        ],
        result: [{ item: "pod_farm:popcorn" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:cooked_egg" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "minecraft:kelp",
            },
        ],
        result: [{ item: "minecraft:dried_kelp" }],
    },
    {
        cooking_blocks: ["furnace", "smoker", "cooking_pan", "oven"],
        category: "cooked_misc",
        ingredients: [
            {
                item: "pod_farm:coffee_plant_seeds",
            },
        ],
        result: [{ item: "pod_farm:coffee" }],
    },
];
const GRILLED = [
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:beef",
            },
        ],
        result: [{ item: "pod_farm:grilled_beef" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:chicken",
            },
        ],
        result: [{ item: "pod_farm:grilled_chicken" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:porkchop",
            },
        ],
        result: [{ item: "pod_farm:grilled_porkchop" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:mutton",
            },
        ],
        result: [{ item: "pod_farm:grilled_mutton" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:rabbit",
            },
        ],
        result: [{ item: "pod_farm:grilled_rabbit" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:cod",
            },
        ],
        result: [{ item: "pod_farm:grilled_cod" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "minecraft:salmon",
            },
        ],
        result: [{ item: "pod_farm:grilled_salmon" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:bison_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_bison" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:venison_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_venison" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:duck_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_duck" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:goose_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_goose" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:turkey_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_turkey" }],
    },
    {
        cooking_blocks: ["grill"],
        category: "cooked_grilled_meat",
        ingredients: [
            {
                item: "pod_farm:yak_raw",
            },
        ],
        result: [{ item: "pod_farm:grilled_yak" }],
    },
];
const CRAFTING_TABLE = [
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "minecraft:bread",
                amount: 3,
            },
        ],
        result: [{ item: "pod_farm:baguette" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:corn",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "minecraft:egg",
            },
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:corn_bread", amount: 3 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:corn",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "pod_farm:quail_egg",
            },
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:corn_bread", amount: 3 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:corn",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "minecraft:egg",
            },
            {
                item: "pod_farm:oat_milk",
            },
        ],
        result: [{ item: "pod_farm:corn_bread", amount: 3 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:corn",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "pod_farm:quail_egg",
            },
            {
                item: "pod_farm:oat_milk",
            },
        ],
        result: [{ item: "pod_farm:corn_bread", amount: 3 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:ginger",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
                amount: 4,
            },
            {
                item: "minecraft:egg",
                amount: 2,
            },
            {
                item: "pod_farm:vanilla",
            },
        ],
        result: [{ item: "pod_farm:gingerbread", amount: 8 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "pod_farm:ginger",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:wheat",
                amount: 4,
            },
            {
                item: "pod_farm:quail_egg",
                amount: 2,
            },
            {
                item: "pod_farm:vanilla",
            },
        ],
        result: [{ item: "pod_farm:gingerbread", amount: 8 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "minecraft:bread",
            },
        ],
        result: [{ item: "pod_farm:bread_slice", amount: 5 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "minecraft:milk_bucket",
            },
        ],
        result: [{ item: "pod_farm:butter", amount: 6 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "minecraft:baked_potato",
            },
        ],
        result: [{ item: "pod_farm:fries" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "pod_farm:baked_sweet_potato",
            },
        ],
        result: [{ item: "pod_farm:sweet_potato_fries" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "pod_farm:fries",
                amount: 2,
            },
            {
                item: "pod_farm:gravy",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
        ],
        result: [{ item: "pod_farm:poutine" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
            {
                item: "pod_farm:tomato_sauce",
                amount: 3,
            },
            {
                item: "pod_farm:bucket_of_cheese",
                amount: 3,
            },
        ],
        result: [{ item: "pod_farm:pizza" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "minecraft:cooked_porkchop",
            },
            {
                item: "pod_farm:pineapple",
            },
            {
                item: "pod_farm:pizza",
            },
        ],
        result: [{ item: "pod_farm:hawaiian_pizza" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_ice_cream",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 2,
            },
            {
                item: "pod_farm:butter",
            },
        ],
        result: [{ item: "pod_farm:ice_cream_cone" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bowls_pasta",
        ingredients: [
            {
                item: "minecraft:potion",
            },
            {
                item: "minecraft:wheat",
            },
        ],
        result: [{ item: "pod_farm:pasta" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "pod_farm:pea",
            },
        ],
        result: [{ item: "pod_farm:pea_seeds", amount: 3 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bowls_misc",
        ingredients: [
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
            {
                item: "pod_farm:cucumber",
            },
            {
                item: "pod_farm:bell_pepper",
            },
        ],
        result: [{ item: "pod_farm:salad" }],
        data: { container: "minecraft:bowl" },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "pod_farm:butter",
            },
            {
                item: "minecraft:egg",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "minecraft:sugar",
            },
        ],
        result: [{ item: "pod_farm:waffle" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "misc",
        ingredients: [
            {
                item: "pod_farm:butter",
            },
            {
                item: "pod_farm:quail_egg",
            },
            {
                item: "minecraft:wheat",
            },
            {
                item: "minecraft:sugar",
            },
        ],
        result: [{ item: "pod_farm:waffle" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_jarred",
        ingredients: [
            {
                item: "pod_farm:peanut",
            },
        ],
        result: [{ item: "pod_farm:peanut_butter" }],
        data: {
            container: "minecraft:glass_bottle",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:hamburger",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
        ],
        result: [{ item: "pod_farm:cheeseburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:poultry_burger",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
        ],
        result: [{ item: "pod_farm:cheeseburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:fish_burger",
            },
            {
                item: "pod_farm:bucket_of_cheese",
            },
        ],
        result: [{ item: "pod_farm:cheeseburger" }],
    },
];
const VANILLA_RECIPES = [
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
        ],
        result: [{ item: "minecraft:bread" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 2,
            },
            {
                item: "minecraft:cocoa_beans",
            },
        ],
        result: [{ item: "minecraft:cookie", amount: 8 }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
            {
                item: "minecraft:milk_bucket",
                amount: 3,
            },
            {
                item: "minecraft:sugar",
                amount: 2,
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "minecraft:cake" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
            {
                item: "pod_farm:oat_milk",
                amount: 3,
            },
            {
                item: "minecraft:sugar",
                amount: 2,
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "minecraft:cake" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
            {
                item: "minecraft:milk_bucket",
                amount: 3,
            },
            {
                item: "minecraft:sugar",
                amount: 2,
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "minecraft:cake" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_misc",
        ingredients: [
            {
                item: "minecraft:wheat",
                amount: 3,
            },
            {
                item: "pod_farm:oat_milk",
                amount: 3,
            },
            {
                item: "minecraft:sugar",
                amount: 2,
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "minecraft:cake" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "minecraft:pumpkin",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "minecraft:pumpkin_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "minecraft:pumpkin",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "minecraft:pumpkin_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_misc",
        ingredients: [
            {
                item: "minecraft:honey_block",
            },
        ],
        result: [{ item: "minecraft:honey_bottle" }],
        data: { container: "minecraft:glass_bottle" },
    },
];
const TINNED = [
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:bean",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_beans" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:corn",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_corn" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:cranberry",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_cranberries" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:lemon",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_lemons" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:peach",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_peaches" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:pear",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_pears" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:pea_seeds",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_peas" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:pineapple",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_pineapples" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:raspberry",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_raspberries" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "preserved_tinned",
        ingredients: [
            {
                item: "pod_farm:tomato",
                amount: 8,
            },
        ],
        result: [{ item: "pod_farm:tinned_tomatoes" }],
        data: {
            container: "pod_farm:tin_can",
        },
    },
];
const SUSHI = [
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "pod_farm:avocado",
            },
        ],
        result: [{ item: "pod_farm:avocado_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "pod_farm:bell_pepper",
            },
        ],
        result: [{ item: "pod_farm:bell_pepper_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "pod_farm:cucumber",
            },
        ],
        result: [{ item: "pod_farm:cucumber_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "minecraft:cod",
            },
        ],
        result: [{ item: "pod_farm:cod_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "minecraft:salmon",
            },
        ],
        result: [{ item: "pod_farm:salmon_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "minecraft:tropical_fish",
            },
        ],
        result: [{ item: "pod_farm:tropical_fish_sushi" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "sushi",
        ingredients: [
            {
                item: "pod_farm:rice",
            },
            {
                item: "minecraft:dried_kelp",
            },
            {
                item: "minecraft:pufferfish",
            },
        ],
        result: [{ item: "pod_farm:pufferfish_sushi" }],
    },
];
const PIES = [
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "minecraft:apple",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:apple_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:blackberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:blackberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:blueberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:blueberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:grape",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:grape_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:peach",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:peach_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:raspberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:raspberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:strawberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:strawberry_tart" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:rhubarb",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "minecraft:egg",
            },
        ],
        result: [{ item: "pod_farm:rhubarb_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "minecraft:apple",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:apple_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:blackberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:blackberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:blueberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:blueberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:grape",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:grape_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:peach",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:peach_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:raspberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:raspberry_pie" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:strawberry",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:strawberry_tart" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "desserts_pies",
        ingredients: [
            {
                item: "pod_farm:rhubarb",
            },
            {
                item: "minecraft:sugar",
            },
            {
                item: "pod_farm:quail_egg",
            },
        ],
        result: [{ item: "pod_farm:rhubarb_pie" }],
    },
];
const BREAD_SLICE_RECIPES = [
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:avocado",
            },
        ],
        result: [{ item: "pod_farm:avocado_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:blueberry_jam",
            },
        ],
        result: [{ item: "pod_farm:blueberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:blackberry_jam",
            },
        ],
        result: [{ item: "pod_farm:blackberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:chili_jam",
            },
        ],
        result: [{ item: "pod_farm:chili_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:grape_jam",
            },
        ],
        result: [{ item: "pod_farm:grape_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:peach_jam",
            },
        ],
        result: [{ item: "pod_farm:peach_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:raspberry_jam",
            },
        ],
        result: [{ item: "pod_farm:raspberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:strawberry_jam",
            },
        ],
        result: [{ item: "pod_farm:strawberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:peanut_butter",
            },
        ],
        result: [{ item: "pod_farm:peanut_butter_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:butter",
            },
        ],
        result: [{ item: "pod_farm:buttered_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "pod_farm:marmalade",
            },
        ],
        result: [{ item: "pod_farm:marmalade_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
            {
                item: "minecraft:honey_bottle",
            },
        ],
        result: [{ item: "pod_farm:honey_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
            {
                item: "minecraft:cooked_porkchop",
            },
        ],
        result: [{ item: "pod_farm:blt" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:spinach",
            },
            {
                item: "minecraft:cooked_chicken",
            },
        ],
        result: [{ item: "pod_farm:chicken_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:cooked_egg",
            },
            {
                item: "pod_farm:tomato",
            },
            {
                item: "pod_farm:lettuce",
            },
        ],
        result: [{ item: "pod_farm:breakfast_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:spinach",
            },
            {
                item: "pod_farm:turkey_cooked",
            },
        ],
        result: [{ item: "pod_farm:turkey_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:chili_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:peach_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich1" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:raspberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich2" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:strawberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich3" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:blueberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich4" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:blackberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich5" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:marmalade",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich6" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:grape_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich7" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "minecraft:cooked_cod",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:fish_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "minecraft:cooked_salmon",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:fish_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "minecraft:cooked_beef",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "minecraft:cooked_mutton",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:bison_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:venison_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:yak_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "minecraft:cooked_chicken",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:duck_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:goose_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
                amount: 2,
            },
            {
                item: "pod_farm:turkey_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
];
const TOAST_RECIPES = [
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:avocado",
            },
        ],
        result: [{ item: "pod_farm:avocado_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:blueberry_jam",
            },
        ],
        result: [{ item: "pod_farm:blueberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:blackberry_jam",
            },
        ],
        result: [{ item: "pod_farm:blackberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:chili_jam",
            },
        ],
        result: [{ item: "pod_farm:chili_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:grape_jam",
            },
        ],
        result: [{ item: "pod_farm:grape_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:peach_jam",
            },
        ],
        result: [{ item: "pod_farm:peach_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:raspberry_jam",
            },
        ],
        result: [{ item: "pod_farm:raspberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:strawberry_jam",
            },
        ],
        result: [{ item: "pod_farm:strawberry_jam_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:peanut_butter",
            },
        ],
        result: [{ item: "pod_farm:peanut_butter_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:butter",
            },
        ],
        result: [{ item: "pod_farm:buttered_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "pod_farm:marmalade",
            },
        ],
        result: [{ item: "pod_farm:marmalade_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_toasts",
        ingredients: [
            {
                item: "pod_farm:toast",
            },
            {
                item: "minecraft:honey_bottle",
            },
        ],
        result: [{ item: "pod_farm:honey_toast" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
            {
                item: "minecraft:cooked_porkchop",
            },
        ],
        result: [{ item: "pod_farm:blt" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:spinach",
            },
            {
                item: "minecraft:cooked_chicken",
            },
        ],
        result: [{ item: "pod_farm:chicken_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:cooked_egg",
            },
            {
                item: "pod_farm:tomato",
            },
            {
                item: "pod_farm:lettuce",
            },
        ],
        result: [{ item: "pod_farm:breakfast_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:spinach",
            },
            {
                item: "pod_farm:turkey_cooked",
            },
        ],
        result: [{ item: "pod_farm:turkey_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:chili_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:peach_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich1" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:raspberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich2" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:strawberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich3" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:blueberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich4" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:blackberry_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich5" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:marmalade",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich6" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_sandwiches",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:peanut_butter",
            },
            {
                item: "pod_farm:grape_jam",
            },
        ],
        result: [{ item: "pod_farm:pb_j_sandwich7" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "minecraft:cooked_cod",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:fish_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "minecraft:cooked_salmon",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:fish_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "minecraft:cooked_beef",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "minecraft:cooked_mutton",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:bison_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:venison_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:yak_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:hamburger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "minecraft:cooked_chicken",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:duck_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:goose_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
    {
        cooking_blocks: ["crafting_table"],
        category: "bread_burgers",
        ingredients: [
            {
                item: "pod_farm:toast",
                amount: 2,
            },
            {
                item: "pod_farm:turkey_cooked",
            },
            {
                item: "pod_farm:lettuce",
            },
            {
                item: "pod_farm:tomato",
            },
        ],
        result: [{ item: "pod_farm:poultry_burger" }],
    },
];
const RECIPE_REGISTRY = [
    {
        cooking_blocks: ["toaster"],
        category: "bread_misc",
        ingredients: [
            {
                item: "pod_farm:bread_slice",
            },
        ],
        result: [{ item: "pod_farm:toast" }],
    },
    ...ICE_CREAM,
    ...SMOOTHIES,
    ...MILKSHAKES,
    ...JUICES,
    ...COOKING_POT,
    ...KETTLE,
    ...COOKED,
    ...GRILLED,
    ...CRAFTING_TABLE,
    ...VANILLA_RECIPES,
    ...TINNED,
    ...SUSHI,
    ...PIES,
    ...BREAD_SLICE_RECIPES,
    ...TOAST_RECIPES,
];

function getItemInSlot(player, slot) {
    const component = player.getComponent(EntityEquippableComponent.componentId);
    return component?.getEquipment(slot);
}
function isHolding(player, item) {
    return getItemInSlot(player, EquipmentSlot.Mainhand)?.typeId === item;
}

const interactables = [
    "crafting_table",
    "decorated_pot",
    "campfire",
    "soul_campfire",
    "lever",
    "frame",
    "glow_frame",
    "lever",
    "composter",
    "acacia_door",
    "acacia_trapdoor",
    "bamboo_door",
    "bamboo_trapdoor",
    "birch_door",
    "birch_trapdoor",
    "cherry_door",
    "cherry_trapdoor",
    "crimson_door",
    "crimson_trapdoor",
    "dark_oak_door",
    "dark_oak_trapdoor",
    "jungle_door",
    "jungle_trapdoor",
    "mangrove_door",
    "mangrove_trapdoor",
    "spruce_door",
    "spruce_trapdoor",
    "trapdoor",
    "warped_door",
    "warped_trapdoor",
    "wooden_door",
    "chest",
    "trapped_chest",
    "ender_chest",
    "barrel",
];

class TimerUtil {
    cooldowns;
    onExpire;
    constructor() {
        this.cooldowns = new Map();
        this.onExpire = {};
    }
    /**
     * Check if a specific id is on cooldown
     * @param id
     * @returns true if the id provided is on cooldown. else false
     */
    has(id) {
        return this.get(id) > system.currentTick;
    }
    /**
     * Gets the current cooldown length of an id, or returns 0
     * @param id
     * @returns cooldown length or 0
     */
    get(id) {
        return this.cooldowns.get(id) || 0;
    }
    /**
     * Sets the cooldown of an specific id
     * @param id
     * @param ticks
     */
    set(id, ticks) {
        const runId = this.onExpire[id];
        if (runId !== undefined)
            system.clearRun(runId);
        this.cooldowns.set(id, system.currentTick + ticks);
    }
    /**
     * Enables the cooldown display for a specific player. the cooldown will be displayed in the action bar until the player is no longer on cooldown
     * @param player
     * @param text A function that returns the text, either as {@link RawMessage} or String
     */
    enableDisplay(player, text) {
        const runId = system.runInterval(() => {
            if (!this.has(player.name)) {
                player.onScreenDisplay.setActionBar("§r");
                system.clearRun(runId);
                return;
            }
            player.onScreenDisplay.setActionBar(text());
        }, 5);
    }
    /**
     * Specifies a function that should be ran when the cooldown for a speicifc id expires
     * @param id
     * @param func
     */
    setOnExpire(id, func) {
        if (!this.has(id))
            return;
        const runId = system.runTimeout(() => {
            this.onExpire[id] = undefined;
            func();
        }, this.get(id) - system.currentTick);
        this.onExpire[id] = runId;
    }
}

const overworld$1 = world.getDimension("overworld");
/**
 * Prefix used for the debugging tag (e.g. podcrash.Debug)
 */
const NAMESPACE$1 = "pod_farm";
/**
 * Parses a JSON Object to a formatted string
 * @param object
 * @returns object parsed to string
 */
function processObject(object) {
    if (!Object.keys(object).length)
        return "§7§oEmpty Object§r";
    let output = "{ ";
    for (const [key, value] of Object.entries(object)) {
        output += `§6${key}§7: §r${process(value)} `;
    }
    return `${output}}`;
}
function process(arg) {
    let output = arg?.toString();
    if (Array.isArray(arg))
        output = `[${arg.map((d) => process(d)).join(", ")}]`;
    else if (arg === null)
        output = `§6null`;
    else
        switch (typeof arg) {
            case "object":
                output = processObject(arg);
                break;
            case "string":
                output = `${arg.startsWith("Error") ? "§c" : '§a"§2'}${arg}§a${arg.startsWith("Error") ? "" : '"'}`;
                break;
            case "number":
                output = isNaN(arg) ? `§5§oNaN` : `§9${arg}`;
                break;
            case "boolean":
                output = `§6${output}`;
                break;
            case "undefined":
                output = `§6undefined`;
                break;
        }
    return `${output}§r`;
}
/**
 * Formats arguments with colour and outputs them to Minecraft chat via tellraw.
 *
 * @param args
 */
function log(...args) {
    overworld$1
        .runCommandAsync(`tellraw @a[tag=${NAMESPACE$1}.Debug] {"rawtext":[{"text":"${args
        .map((d) => process(d))
        .join(" ")
        .replaceAll('"', '\\"')}"}]}`)
        .then()
        .catch();
}
/**
 * Logs a warning to the Minecraft Content Log
 * @param args
 */
function warn(...args) {
    // eslint-disable-next-line no-undef
    console.warn(...args.map(process));
}
/**
 * Logs an error to the Minecraft Content Log
 * @param args
 */
function error(...args) {
    // eslint-disable-next-line no-undef
    console.error(...args.map(process));
}

/**
 * Randomly selects a value of an array considering a weight
 * @param options Object that has either a weight property (number) or a weight() function that returns a number.
 * @returns
 */
/**
 * Chooses random value from array list
 * @param array Array
 * @returns Chosen Value
 */
function randomSelection(array) {
    return array[Math.floor(Math.random() * array.length)];
}
/**
 * Advanced random function. Leave arguments empty for classic random result
 * @param min Minimum value of random (Defaults to 0)
 * @param max Maximum value of random (Defaults to min+1)
 * @param rounded Should the result be rounded?
 * @returns Random Number
 */
function rand(min = 0, max = min + 1, rounded = false) {
    return rounded
        ? Math.round(min + Math.random() * (max - min))
        : min + Math.random() * (max - min);
}

/*
Stats Tracking Code Start - Utility Function
*/
const incrementStat = (stat, value) => {
    try {
        const objective = world.scoreboard.getObjective("pod_farm:jig_computer.addon_stats");
        objective.addScore(`pod_farm:${stat}`, value);
    }
    catch (e) { }
};
/*
Stats Tracking Code End
*/
const DEFINED_ICON_PATHS = {
    "minecraft:baked_potato": "textures/items/potato_baked.png",
    "minecraft:cooked_beef": "textures/items/beef_cooked.png",
    "minecraft:cooked_chicken": "textures/items/chicken_cooked.png",
    "minecraft:cooked_porkchop": "textures/items/porkchop_cooked.png",
    "minecraft:cooked_mutton": "textures/items/mutton_cooked.png",
    "minecraft:cooked_rabbit": "textures/items/rabbit_cooked.png",
    "minecraft:cooked_cod": "textures/items/fish_cooked.png",
    "minecraft:cooked_salmon": "textures/items/fish_salmon_cooked.png",
    "pod_farm:vanillla_ice_cream": "textures/podcrash/farm/items/vanilla_ice_cream.png",
    "pod_farm:pea_seeds": "textures/podcrash/farm/items/pea_spawn_egg.png",
    "pod_farm:pb_j_sandwich1": "textures/podcrash/farm/items/pb_j_sandwich2.png",
    "pod_farm:pb_j_sandwich2": "textures/podcrash/farm/items/pb_j_sandwich.png",
    "pod_farm:pb_j_sandwich3": "textures/podcrash/farm/items/pb_j_sandwich.png",
    "pod_farm:pb_j_sandwich4": "textures/podcrash/farm/items/pb_j_sandwich1.png",
    "pod_farm:pb_j_sandwich5": "textures/podcrash/farm/items/pb_j_sandwich1.png",
    "pod_farm:pb_j_sandwich6": "textures/podcrash/farm/items/pb_j_sandwich2.png",
    "pod_farm:pb_j_sandwich7": "textures/podcrash/farm/items/pb_j_sandwich1.png",
    "pod_farm:peanut_butter_toast": "textures/podcrash/farm/items/peanut_buttered_toast.png",
};
function getIconPathByItem(item) {
    const defined_path = DEFINED_ICON_PATHS[item];
    if (defined_path !== undefined)
        return defined_path;
    let s = "";
    if (item.startsWith("minecraft:"))
        s = `textures/items/${item.replace("minecraft:", "")}.png`;
    if (item.startsWith("pod_farm:"))
        s = `textures/podcrash/farm/items/${item.replace("pod_farm:", "")}.png`;
    //Some special multi occassions
    if (s.includes("/grilled_"))
        s = s.replace("/grilled_", "/grilled/grilled_");
    if (s.includes("/tinned_"))
        s = s.replace("/tinned_", "/tinned/tinned_");
    if (s.includes("milkshake.png"))
        s = s.replace("farm/items", "farm/items/milkshake");
    if (s.includes("smoothie.png"))
        s = s.replace("farm/items", "farm/items/smoothie");
    return s;
}
const SPECIAL_LOCALISATIONS = {
    "minecraft:brown_mushroom": "tile.brown_mushroom.name",
    "minecraft:red_mushroom": "tile.red_mushroom.name",
    "minecraft:water_bucket": "item.bucketWater.name",
    "minecraft:milk_bucket": "item.milk.name",
    "minecraft:melon_slice": "item.melon.name",
    "minecraft:cooked_mutton": "item.muttonCooked.name",
    "minecraft:cooked_cod": "item.cooked_fish.name",
    "minecraft:enchanted_golden_apple": "item.appleEnchanted.name",
    "minecraft:cocoa_beans": "item.dye.brown.name",
    "minecraft:honey_block": "tile.honey_block.name",
    "minecraft:potion": "potion.emptyPotion.name",
    "minecraft:cod": "item.fish.name",
    "minecraft:tropical_fish": "item.clownfish.name",
    "minecraft:mutton": "item.muttonRaw.name",
    "minecraft:pumpkin": "tile.pumpkin.name",
};
const getLocalisedItemName = (item) => {
    return (SPECIAL_LOCALISATIONS[item] ||
        `item.${item.replace("minecraft:", "")}${item.includes("minecraft:") ? ".name" : ""}`);
};
function spawnLoot(dimension, location, lootArray, player) {
    for (const loot of lootArray) {
        if (player !== undefined && loot.fortune) {
            const fortune = fortuneLevelOnHoe(player);
            if (fortune !== 0) {
                if (0.6 + 0.1 * (fortune - 1) >= rand())
                    dimension.spawnItem(new ItemStack(loot.item), location);
            }
        }
        dimension.spawnItem(new ItemStack(loot.item, typeof loot.amount === "number"
            ? loot.amount
            : rand(loot.amount[0], loot.amount[1], true)), location);
    }
}
function fortuneLevelOnHoe(player) {
    const equipment = player.getComponent(EntityEquippableComponent.componentId);
    const item = equipment.getEquipment(EquipmentSlot.Mainhand);
    if (item === undefined)
        return 0;
    if (!item.hasTag("minecraft:is_hoe"))
        return 0;
    const enchantmentComponent = item.getComponent(ItemEnchantableComponent.componentId);
    if (enchantmentComponent === undefined)
        return 0;
    const enchantment = enchantmentComponent.getEnchantment("minecraft:fortune");
    if (enchantment === undefined)
        return 0;
    return enchantment.level;
}
const warningTimer = new TimerUtil();
function displayWarning(player, id) {
    player.dimension.playSound("pod_farm.cookware.fail", player.location);
    if (warningTimer.has(player.id + "@" + id))
        player.onScreenDisplay.setActionBar({ translate: `pod_farm.warn.${id}` });
    warningTimer.set(player.id + "@" + id, 20);
}
function compareArrays(a, b) {
    if (a.length !== b.length)
        return false;
    b = b.sort();
    return a.sort().every((v, i) => v === b[i]);
}
const isString = (value) => {
    return typeof value === "string" || value instanceof String;
};
const handleAsync = (promise, where = "") => {
    promise.catch((e) => {
        log(`Error occurred ${where.length ? `[${where}]` : ""} : §c${e}`);
    });
};
function compareRecords(record1, record2) {
    // Step 1: Get the keys of both records
    const keys1 = Object.keys(record1);
    const keys2 = Object.keys(record2);
    // Step 2: Check if both records have the same number of keys
    if (keys1.length !== keys2.length) {
        return false;
    }
    // Step 3: Check if all keys and values are the same
    for (const key of keys1) {
        // Check if both records have the same key
        if (!keys2.includes(key)) {
            return false;
        }
        const val1 = record1[key];
        const val2 = record2[key];
        // Check if both values are objects, do a deep comparison
        if (typeof val1 === "object" && typeof val2 === "object") {
            if (!compareRecords(val1, val2)) {
                return false;
            }
        }
        else if (val1 !== val2) {
            // If the values are primitive, check for equality
            return false;
        }
    }
    return true;
}

/*
const buttonExample = {
  text: String | RawMessage -> {translate: "pod.example"},
  icon: String -> "textures/items/iron_ingot", //can be undefined, button will have no icon then.
  action: function with the player as parameter -> showPage("main", 0, []), //can be any function or undefined. If undefined, the button will close the menu.
};
*/
/**
 * Shows a page to a player and adds all specified buttons to it with their actions
 * @param player
 * @param title Title of the page
 * @param body Body of the page
 * @param buttons Buttons as array
 */
const showPage = async (player, title, body, buttons) => {
    if (!buttons || !buttons.length) {
        console.warn(`Failed to show Page: Requires Button.`);
        return;
    }
    const form = new ActionFormData();
    form.title(title);
    form.body(body);
    for (const button of buttons) {
        form.button(button.text, button.icon);
    }
    const response = await form.show(player);
    if (response.canceled || response.selection === undefined)
        return;
    const action = buttons[response.selection].action;
    if (!action)
        return;
    action(player);
};
class RawtextBuilder {
    body;
    constructor() {
        this.body = [];
    }
    /**
     * Adds elements to the body
     * @param elements
     */
    push(...elements) {
        for (const element of elements) {
            if (typeof element === "string" || element instanceof String) {
                this.body.push({ text: element });
            }
            else {
                this.body.push(element);
            }
        }
    }
    /**
     * Adds elements to the body and an empty line after that.
     * @param elements
     */
    pushLine(...elements) {
        this.push(...elements);
        this.push({ text: "§r\n" });
    }
    /**
     * Builds the RawMessage with all elements added to it
     * @returns RawMessage
     */
    build() {
        return { rawtext: this.body };
    }
}

const MAIN_PAGE = {
    id: "main",
    icon: "",
    categories: [
        {
            id: "cooked",
            icon: "textures/items/beef_cooked.png",
            categories: [
                { id: "cooked_meat", icon: "textures/items/beef_cooked.png" },
                {
                    id: "cooked_grilled_meat",
                    icon: "textures/podcrash/farm/items/grilled/grilled_chicken.png",
                },
                {
                    id: "cooked_misc",
                    icon: "textures/podcrash/farm/items/cooked_egg.png",
                },
            ],
        },
        {
            id: "bowls",
            icon: "textures/items/bowl.png",
            categories: [
                { id: "bowls_pasta", icon: "textures/podcrash/farm/items/pasta.png" },
                {
                    id: "bowls_soup",
                    icon: "textures/podcrash/farm/items/tomato_soup.png",
                },
                { id: "bowls_misc", icon: "textures/podcrash/farm/items/salad.png" },
            ],
        },
        {
            id: "bread",
            icon: "textures/items/bread.png",
            categories: [
                {
                    id: "bread_toasts",
                    icon: "textures/podcrash/farm/items/avocado_toast.png",
                },
                {
                    id: "bread_sandwiches",
                    icon: "textures/podcrash/farm/items/chicken_sandwich.png",
                },
                {
                    id: "bread_burgers",
                    icon: "textures/podcrash/farm/items/hamburger.png",
                },
                { id: "bread_misc", icon: "textures/podcrash/farm/items/baguette.png" },
            ],
        },
        { id: "sushi", icon: "textures/podcrash/farm/items/cod_sushi.png" },
        {
            id: "desserts",
            icon: "textures/podcrash/farm/items/strawberry_ice_cream.png",
            categories: [
                {
                    id: "desserts_pies",
                    icon: "textures/podcrash/farm/items/blueberry_pie.png",
                },
                {
                    id: "desserts_ice_cream",
                    icon: "textures/podcrash/farm/items/blackberry_ice_cream.png",
                },
                {
                    id: "desserts_misc",
                    icon: "textures/items/cookie.png",
                },
            ],
        },
        {
            id: "drinks",
            icon: "textures/podcrash/farm/items/milkshake/berry_rhubarb_milkshake.png",
            categories: [
                {
                    id: "drinks_juices",
                    icon: "textures/podcrash/farm/items/cranberry_juice.png",
                },
                {
                    id: "drinks_smoothies",
                    icon: "textures/podcrash/farm/items/smoothie/berry_banana_smoothie.png",
                },
                {
                    id: "drinks_milkshakes",
                    icon: "textures/podcrash/farm/items/milkshake/berry_rhubarb_milkshake.png",
                },
                {
                    id: "drinks_misc",
                    icon: "textures/podcrash/farm/items/cup_of_coffee.png",
                },
            ],
        },
        {
            id: "preserved",
            icon: "textures/podcrash/farm/items/tinned/tin_can.png",
            categories: [
                {
                    id: "preserved_jarred",
                    icon: "textures/podcrash/farm/items/strawberry_jam.png",
                },
                {
                    id: "preserved_tinned",
                    icon: "textures/podcrash/farm/items/tinned/tinned_pears.png",
                },
                {
                    id: "preserved_misc",
                    icon: "textures/podcrash/farm/items/tomato_sauce.png",
                },
            ],
        },
        {
            id: "misc",
            icon: "textures/podcrash/farm/items/pizza.png",
        },
    ],
};
world.afterEvents.itemUse.subscribe((event) => {
    if (event.itemStack.typeId === "pod_farm:cookbook") {
        showCategoryPage(event.source, event.itemStack, MAIN_PAGE);
    }
});
function displayPinnedRecipe() {
    for (const player of world.getAllPlayers()) {
        const item = getItemInSlot(player, EquipmentSlot.Mainhand);
        if (item && item.typeId === "pod_farm:cookbook") {
            const pinnedItem = item.getDynamicProperty("pinned_recipe");
            if (pinnedItem !== undefined) {
                const recipe = RECIPE_REGISTRY.filter((v) => v.result[0].item === pinnedItem.split("@")[0])[parseInt(pinnedItem.split("@")[1])];
                if (recipe !== undefined) {
                    const body = new RawtextBuilder();
                    body.pushLine({ text: "§l" }, {
                        translate: getLocalisedItemName(recipe.result[0].item),
                    });
                    for (const ingredient of recipe.ingredients || []) {
                        body.pushLine({
                            translate: "pod_farm.cookbook.ingredient",
                            with: {
                                rawtext: [
                                    { text: `${ingredient.amount || 1}` },
                                    { translate: getLocalisedItemName(ingredient.item) },
                                ],
                            },
                        });
                    }
                    if (recipe.data?.optional?.ingredients?.length >= 1) {
                        for (const ingredient of recipe.data.optional.ingredients) {
                            body.pushLine({
                                translate: "pod_farm.cookbook.optional_ingredient",
                                with: {
                                    rawtext: [
                                        { text: `${ingredient.amount || 1}` },
                                        { translate: getLocalisedItemName(ingredient.item) },
                                    ],
                                },
                            });
                        }
                    }
                    if (recipe.data?.milk === true) {
                        body.pushLine({
                            translate: "pod_farm.cookbook.milk_short",
                        });
                    }
                    if (recipe.data?.container !== undefined) {
                        body.pushLine({
                            translate: "pod_farm.cookbook.container_short",
                            with: {
                                rawtext: [
                                    { translate: getLocalisedItemName(recipe.data.container) },
                                ],
                            },
                        });
                    }
                    player.onScreenDisplay.setActionBar(body.build());
                }
            }
        }
    }
}
function openCookbook(player, itemStack, backButtonAction) {
    showCategoryPage(player, itemStack, MAIN_PAGE, backButtonAction);
}
/**
 *
 * @param {Player} player
 * @param {*} category
 */
function showCategoryPage(player, itemStack, category, backButtonAction = undefined) {
    const buttons = [];
    for (const subcategory of category.categories || []) {
        buttons.push({
            text: `pod_farm.cookbook.category.${subcategory.id}`,
            icon: subcategory.icon,
            action: () => {
                showCategoryPage(player, itemStack, subcategory, () => {
                    showCategoryPage(player, itemStack, category, backButtonAction);
                });
            },
        });
    }
    const includedRecipes = [];
    for (const recipe of RECIPE_REGISTRY.filter((v) => v.category === category.id)) {
        const item = recipe.result[0].item;
        if (includedRecipes.includes(item))
            continue;
        buttons.push({
            text: { translate: getLocalisedItemName(item) },
            icon: getIconPathByItem(item),
            action: () => {
                showRecipePage(player, itemStack, item, () => {
                    showCategoryPage(player, itemStack, category, backButtonAction);
                });
            },
        });
        includedRecipes.push(item);
    }
    buttons.push({
        text: { translate: "pod_farm.guide.common.back_button" },
        action: backButtonAction,
    });
    showPage(player, { translate: `pod_farm.cookbook.category.${category.id}` }, { translate: "pod_farm.cookbook.description" }, buttons);
}
function showRecipePage(player, itemStack, recipeId, backButtonAction) {
    const body = new RawtextBuilder();
    const buttons = [];
    const recipes = RECIPE_REGISTRY.filter((v) => v.result[0].item === recipeId);
    body.pushLine({
        translate: "pod_farm.cookbook.recipe_description",
        with: { rawtext: [{ translate: getLocalisedItemName(recipeId) }] },
    });
    for (let i = 0; i < recipes[0].cooking_blocks.length; i++) {
        body.push({
            translate: `pod_farm.cookbook.block.${recipes[0].cooking_blocks[i]}`,
        });
        if (i + 1 !== recipes[0].cooking_blocks.length)
            body.push({ text: `§r, ` });
    }
    body.pushLine();
    let i = 1;
    for (const recipe of recipes) {
        body.pushLine();
        if (recipes.length !== 1) {
            body.pushLine({
                translate: "pod_farm.cookbook.recipe_header",
                with: [`${i}`],
            });
            body.pushLine();
        }
        body.pushLine({ translate: "pod_farm.cookbook.ingredients_header" });
        for (const ingredient of recipe.ingredients || []) {
            body.pushLine({
                translate: "pod_farm.cookbook.ingredient",
                with: {
                    rawtext: [
                        { text: `${ingredient.amount || 1}` },
                        { translate: getLocalisedItemName(ingredient.item) },
                    ],
                },
            });
        }
        if (recipe.data?.optional?.ingredients?.length >= 1) {
            for (const ingredient of recipe.data.optional.ingredients) {
                body.pushLine({
                    translate: "pod_farm.cookbook.optional_ingredient",
                    with: {
                        rawtext: [
                            { text: `${ingredient.amount || 1}` },
                            { translate: getLocalisedItemName(ingredient.item) },
                        ],
                    },
                });
            }
        }
        body.pushLine();
        const min = recipe.data?.optional?.min || 0;
        if (min > 0)
            body.pushLine({
                translate: "pod_farm.cookbook.min_optional_ingredients",
                with: [`${min}`],
            });
        if (recipe.data?.container !== undefined) {
            body.pushLine({
                translate: "pod_farm.cookbook.container",
                with: {
                    rawtext: [{ translate: getLocalisedItemName(recipe.data.container) }],
                },
            });
        }
        if (recipe.data?.milk === true) {
            body.pushLine({
                translate: "pod_farm.cookbook.milk",
            });
        }
        if (itemStack.typeId === "pod_farm:cookbook") {
            const indexCopy = i;
            buttons.push({
                text: {
                    translate: recipes.length === 1
                        ? "pod_farm.cookbook.pin_button"
                        : "pod_farm.cookbook.pin_button_indexed",
                    with: [`${i}`],
                },
                action: () => {
                    itemStack.setDynamicProperty("pinned_recipe", recipeId + "@" + (indexCopy - 1));
                    const equipment = player.getComponent(EntityEquippableComponent.componentId);
                    if (equipment.getEquipment(EquipmentSlot.Mainhand)?.typeId ===
                        "pod_farm:cookbook")
                        equipment.setEquipment(EquipmentSlot.Mainhand, itemStack);
                },
            });
        }
        i++;
    }
    buttons.push({
        text: { translate: "pod_farm.guide.common.back_button" },
        action: backButtonAction,
    });
    showPage(player, { translate: getLocalisedItemName(recipeId) }, body.build(), buttons);
}

const cropRegistry = {
    "pod_farm:blackberry_bush": {
        maxGrowth: 2,
        regrowthStage: 1,
        harvestLoot: [
            { item: "pod_farm:blackberry", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:blueberry_bush": {
        maxGrowth: 2,
        regrowthStage: 1,
        harvestLoot: [
            { item: "pod_farm:blueberry", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:cranberry_bush": {
        maxGrowth: 2,
        regrowthStage: 1,
        harvestLoot: [
            { item: "pod_farm:cranberry", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:raspberry_bush": {
        maxGrowth: 2,
        regrowthStage: 1,
        harvestLoot: [
            { item: "pod_farm:raspberry", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:strawberry_bush": {
        maxGrowth: 2,
        regrowthStage: 1,
        harvestLoot: [
            { item: "pod_farm:strawberry", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:coffee_plant": {
        maxGrowth: 4,
        regrowthStage: 2,
        harvestLoot: [
            { item: "pod_farm:coffee_plant_seeds", amount: [2, 3], fortune: true },
        ],
    },
    "pod_farm:broccoli_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:broccoli", amount: 1, fortune: false },
            { item: "pod_farm:broccoli_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:cauliflower_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:cauliflower", amount: 1, fortune: false },
            { item: "pod_farm:cauliflower_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:kohlrabi_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:kohlrabi", amount: 1, fortune: false },
            { item: "pod_farm:kohlrabi_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:cotton_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:cotton", amount: 1, fortune: false },
            { item: "pod_farm:cotton_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:ginger_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:ginger", amount: 1, fortune: false },
            { item: "pod_farm:ginger_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:lettuce_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:lettuce", amount: 1, fortune: false },
            { item: "pod_farm:lettuce_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:oat_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:oat", amount: 1, fortune: false },
            { item: "pod_farm:oat_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:onion_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:onion", amount: 1, fortune: false },
            { item: "pod_farm:onion_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:pea_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        harvestLoot: [
            { item: "pod_farm:pea", amount: 1, fortune: false },
            { item: "pod_farm:pea_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:peanut_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        harvestLoot: [
            { item: "pod_farm:peanut", amount: 1, fortune: false },
            { item: "pod_farm:peanut_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:rhubarb_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        harvestLoot: [
            { item: "pod_farm:rhubarb", amount: 1, fortune: false },
            { item: "pod_farm:rhubarb_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:rice_plant": {
        maxGrowth: 6,
        harvestLoot: [
            { item: "pod_farm:rice", amount: 1, fortune: false },
            { item: "pod_farm:rice_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:spinach_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        harvestLoot: [
            { item: "pod_farm:spinach", amount: 1, fortune: false },
            { item: "pod_farm:spinach_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:sweet_potato_plant": {
        maxGrowth: 6,
        harvestLoot: [{ item: "pod_farm:sweet_potato", amount: 2, fortune: true }],
    },
    "pod_farm:bean_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        layers: {
            amount: 2,
            1: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:bean", amount: 1, fortune: false },
            { item: "pod_farm:bean_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:bell_pepper_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        layers: {
            amount: 2,
            1: {
                atStage: 2,
            },
        },
        harvestLoot: [
            { item: "pod_farm:bell_pepper", amount: 1, fortune: false },
            { item: "pod_farm:bell_pepper_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:chili_plant": {
        maxGrowth: 6,
        regrowthStage: 4,
        layers: {
            amount: 2,
            1: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:chili", amount: 1, fortune: false },
            { item: "pod_farm:chili_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:cucumber_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        layers: {
            amount: 2,
            1: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:cucumber", amount: 1, fortune: false },
            { item: "pod_farm:cucumber_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:tomato_plant": {
        maxGrowth: 6,
        regrowthStage: 1,
        layers: {
            amount: 2,
            1: {
                atStage: 1,
            },
        },
        harvestLoot: [
            { item: "pod_farm:tomato", amount: 1, fortune: false },
            { item: "pod_farm:tomato_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:vanilla_plant": {
        maxGrowth: 6,
        regrowthStage: 3,
        layers: {
            amount: 2,
            1: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:vanilla", amount: 1, fortune: false },
            { item: "pod_farm:vanilla_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:corn_plant": {
        maxGrowth: 6,
        layers: {
            amount: 3,
            1: {
                atStage: 2,
            },
            2: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:corn", amount: 1, fortune: false },
            { item: "pod_farm:corn_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:grape_vine": {
        maxGrowth: 6,
        regrowthStage: 3,
        layers: {
            amount: 2,
            1: {
                atStage: 2,
            },
        },
        harvestLoot: [
            { item: "pod_farm:grape", amount: 1, fortune: false },
            { item: "pod_farm:grape_vine_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:pineapple_plant": {
        maxGrowth: 4,
        regrowthStage: 2,
        layers: {
            amount: 2,
            1: {
                atStage: 3,
            },
        },
        harvestLoot: [
            { item: "pod_farm:pineapple", amount: 1, fortune: false },
            { item: "pod_farm:pineapple_plant_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:tea_plant": {
        maxGrowth: 4,
        regrowthStage: 2,
        layers: {
            amount: 2,
            1: {
                atStage: 2,
            },
        },
        harvestLoot: [
            { item: "pod_farm:tea", amount: 1, fortune: false },
            { item: "pod_farm:tea_plant_seeds", amount: 1, fortune: true },
        ],
    },
    "pod_farm:banana_cluster": {
        maxGrowth: 3,
        regrowthStage: 0,
        harvestLoot: [{ item: "pod_farm:banana", amount: [2, 3], fortune: true }],
    },
};
const farmland_only_crops = [
    "pod_farm:tomato",
    "pod_farm:rhubarb",
    "pod_farm:corn",
    "pod_farm:spinach",
    "pod_farm:rice",
    "pod_farm:bell_pepper",
    "pod_farm:broccoli",
    "pod_farm:kohlrabi",
    "pod_farm:pea",
    "pod_farm:cucumber",
    "pod_farm:onion",
    "pod_farm:oat",
    "pod_farm:chili",
    "pod_farm:lettuce",
    "pod_farm:cauliflower",
    "pod_farm:sweet_potato",
    "pod_farm:cotton",
    "pod_farm:ginger",
    "pod_farm:vanilla",
    "pod_farm:peanut",
    "pod_farm:bean",
];

/**
 * Adds one vector to another
 * @param vectorA
 * @param vectorB
 * @returns Result as Vector
 */
function addVector(vectorA, vectorB) {
    return {
        x: vectorA.x + (vectorB.x || 0),
        y: vectorA.y + (vectorB.y || 0),
        z: vectorA.z + (vectorB.z || 0),
    };
}
/**
 * Converts Vector to string
 * @param vector
 * @param fractionDigits Amount of digits the vector should be rounded to
 * @returns vector as string useable in minecraft commands
 */
function vectorToString(vector, fractionDigits) {
    {
        return `${vector.x} ${vector.y} ${vector.z}`;
    }
}
/**
 * Moves a vector forward by a specified distance in a specified direction
 * @param location Origin
 * @param rotation Direction to move towards
 * @param length Distance to move forward
 * @returns moved vector
 */
function forward(location, rotation, length) {
    const yaw = (rotation.y * Math.PI) / 180.0;
    location.x -= Math.sin(yaw) * length;
    location.z += Math.cos(yaw) * length;
    return location;
}
/**
 * Checks if two vectors match
 * @param vectorA
 * @param vectorB
 * @returns
 */
function vectorMatches(vectorA, vectorB) {
    return (vectorA.x === vectorB.x &&
        vectorA.y === vectorB.y &&
        vectorA.z === vectorB.z);
}
function getVectorInDirection(vector, direction, steps = 1) {
    switch (direction.toLowerCase()) {
        case Direction.Up.toLowerCase():
            return addVector(vector, { y: steps });
        case Direction.Down.toLowerCase():
            return addVector(vector, { y: -steps });
        case Direction.North.toLowerCase():
            return addVector(vector, { z: -steps });
        case Direction.South.toLowerCase():
            return addVector(vector, { z: steps });
        case Direction.East.toLowerCase():
            return addVector(vector, { x: steps });
        case Direction.West.toLowerCase():
            return addVector(vector, { x: -steps });
    }
}

/**
 * Checks if the permutation of a block is included in a list of permutations
 * @param permutation
 * @param permutationList
 * @returns true if permutation is included in the list
 */
function permutationMatches(permutation, permutationList) {
    return indexOfPermutationMatched(permutation, permutationList) !== -1;
}
/**
 * Checks if the permutation of a block is included in a list of permutations
 * @param permutation
 * @param permutationList
 * @returns index of the permutation matched if any is found or -1
 */
function indexOfPermutationMatched(permutation, permutationList) {
    for (const toCheck of permutationList) {
        if (permutation?.matches(toCheck.block, toCheck.states) ?? true) {
            return permutationList.indexOf(toCheck);
        }
    }
    return -1;
}
/**
 * Gets block that should be replaced based on a block face
 * @param block Origin Block
 * @param blockFace Block Face
 * @returns Block found or undefined
 */
function getReplacedBlockByBlockFace(block, blockFace) {
    switch (blockFace) {
        case Direction.Down:
            return block.below();
        case Direction.North:
            return block.north();
        case Direction.East:
            return block.east();
        case Direction.South:
            return block.south();
        case Direction.West:
            return block.west();
        case Direction.Up:
            return block.above();
    }
}
function breakBlockSafely(block, destroy = true) {
    block.dimension.runCommand(`execute positioned ${vectorToString(block.location)} if block ~ ~ ~ ${block.typeId} run setblock ~ ~ ~ air${destroy ? " destroy" : ""}`);
}
function getBlockInDirection(dimension, location, direction, steps = 1) {
    try {
        const locationInDirection = getVectorInDirection(location, direction, steps);
        if (!locationInDirection)
            return undefined;
        return dimension.getBlock(locationInDirection);
    }
    catch (e) {
        return undefined;
    }
}

function breakCrop(block, player, noLoot) {
    onCropBreak(block, block.permutation, player, noLoot);
    breakBlockSafely(block);
}
//permutation need their own property in cases where the block is already broken
function onCropBreak(block, permutation = block.permutation, player, noLoot) {
    const multiCrop = getMultiCrop(block, permutation);
    if (multiCrop.length > 1) {
        multiCrop.shift();
        for (const crop of multiCrop) {
            if (!crop.isAir) {
                const permutation = crop.permutation;
                breakBlockSafely(crop);
                onCropBreak(crop, permutation, player, true);
            }
        }
    }
    const data = cropRegistry[permutation.type.id];
    if (data !== undefined) {
        if (!noLoot &&
            permutation.getState("pod_farm:growth") === data.maxGrowth) {
            if (player?.getGameMode() === GameMode.creative) ;
            else {
                spawnLoot(block.dimension, block.center(), data.harvestLoot, player);
            }
        }
        if (data.onBreak !== undefined)
            data.onBreak(block, permutation, player);
    }
}
function getMultiCrop(block, permutation = block.permutation) {
    let blocks = [block];
    const cropData = cropRegistry[permutation.type.id];
    if (cropData === undefined || cropData.layers === undefined)
        return blocks;
    const blockLayer = permutation.getState("pod_farm:layer");
    if (blockLayer === undefined) {
        warn(`${permutation.type.id} has ${cropData.layers} layers registered, but the state of 'pod_farm:layer' is undefined`);
        return blocks;
    }
    const root = blockLayer === 0 ? block : block.below(blockLayer);
    if (root === undefined)
        throw new Error(`Multi-Block Crop at ${vectorToString(block.location)} has no root.`);
    for (let i = 0; i < cropData.layers.amount; i++) {
        if (i === blockLayer)
            continue;
        const layer = root.above(i);
        if (layer === undefined || layer.typeId !== root.typeId)
            continue;
        blocks.push(layer);
    }
    return blocks;
}
function getRootOfCrop(blocks) {
    return blocks.find((v) => {
        const layer = v.permutation?.getState("pod_farm:layer");
        if (layer === undefined || layer !== 0)
            return false;
        return true;
    });
}
function boneMealCrop(block, newStage) {
    changeGrowth(block, newStage);
    world.playSound("item.bone_meal.use", block.center());
    block.dimension.spawnParticle("minecraft:crop_growth_emitter", block.center());
}
function changeGrowth(block, newStage) {
    const cropData = cropRegistry[block.typeId];
    if (cropData === undefined)
        return;
    if (newStage < 0 || newStage > cropData.maxGrowth) {
        warn(`Tried to grow crop at ${block.location} to an invalid scale.`);
        return;
    }
    if (cropData.layers === undefined) {
        block.setPermutation(block.permutation.withState("pod_farm:growth", newStage));
        return;
    }
    const blocksToBeScaled = [];
    const presentLayers = [];
    const blocks = getMultiCrop(block);
    for (const currentPart of blocks) {
        if (currentPart.typeId !== block.typeId)
            throw new Error(`Unintentional block in multi crop structure at ${vectorToString(block.location)}`);
        const currentLayer = currentPart.permutation.getState("pod_farm:layer");
        if (currentLayer === undefined)
            throw new Error(`Crop Part at ${vectorToString(currentPart.location)} is missing state 'pod_farm:layer'`);
        const atStage = cropData.layers?.[currentLayer]?.atStage || 0;
        if (atStage > newStage) {
            system.runTimeout(() => currentPart.setPermutation(BlockPermutation.resolve("minecraft:air")));
            continue;
        }
        presentLayers.push(currentLayer);
        blocksToBeScaled.push(currentPart);
    }
    const missingLayers = [];
    for (let i = 0; i < cropData.layers.amount; i++) {
        if (presentLayers.includes(i))
            continue;
        const atStage = cropData.layers?.[i]?.atStage || 0;
        if (atStage <= newStage)
            missingLayers.push(i);
    }
    const root = getRootOfCrop(blocks);
    if (root === undefined)
        throw new Error(`Root of crop structure at ${vectorToString(block.location)} is missing`);
    for (const layer of missingLayers.sort((a, b) => a - b)) {
        const currentPart = root?.above(layer);
        //Cancel growth because required space is not given
        if (currentPart !== undefined && !currentPart.isAir)
            return;
        currentPart?.setPermutation(root?.permutation.withState("pod_farm:layer", layer));
        blocksToBeScaled.push(currentPart);
    }
    for (const part of blocksToBeScaled) {
        part?.setPermutation(part.permutation.withState("pod_farm:growth", newStage));
    }
}

const component$c = {
    onPlayerInteract: (event) => {
        if (event.player === undefined)
            return;
        const cropData = cropRegistry[event.block.typeId];
        if (!cropData)
            return;
        const currentGrowth = event.block.permutation.getState("pod_farm:growth");
        //Prevention to disallow picking when the crop was just bone mealed.
        system.runTimeout(() => {
            if (event.block.permutation.getState("pod_farm:growth") !== currentGrowth)
                return;
            //Prevention end
            if (currentGrowth === cropData.maxGrowth) {
                changeGrowth(event.block, cropData.regrowthStage || 0);
                spawnLoot(event.dimension, event.block.center(), cropData.harvestLoot);
                world.playSound("block.sweet_berry_bush.pick", event.block.center());
            }
        }, 2);
    },
};

const component$b = {
    onRandomTick: async (event) => {
        try {
            const cropData = cropRegistry[event.block.typeId];
            if (!cropData)
                return;
            const currentGrowth = event.block.permutation.getState("pod_farm:growth");
            if (currentGrowth === cropData.maxGrowth)
                return;
            if (!(await checkLightLevel(event.dimension, event.block.center())))
                return;
            changeGrowth(event.block, currentGrowth + 1);
        }
        catch (e) { }
    },
};
const warnCooldown$1 = new TimerUtil();
async function checkLightLevel(dimension, location) {
    if (dimension.getEntities({ type: "pod_farm:light_test" }).length >= 50) {
        const loc = vectorToString(location);
        if (warnCooldown$1.has(loc))
            return true;
        warnCooldown$1.set(loc, 20);
        warn(`Skipping Light Test on Crop at ${loc}: Light Test Entity limit exceeded.`);
        return true;
    }
    const testEntity = dimension.spawnEntity("pod_farm:light_test", location);
    await system.waitTicks(3);
    return testEntity.getProperty("pod_farm:has_light");
}

/**
 * Consumes a specified item from the players inventory
 * @param player
 * @param item the item identifier
 * @param amount the amount, defaults to 1
 */
function consumeItem(player, item, amount = 1, consumeInCreative = false) {
    if (player.getGameMode() === GameMode.creative && !consumeInCreative)
        return;
    player.runCommand(`clear @s ${item} 0 ${amount}`);
}
function damageEquipmentSafely(player, itemSlot = EquipmentSlot.Mainhand, damage = 1) {
    if (player.getGameMode() === GameMode.creative)
        return;
    const equipment = player.getComponent(EntityEquippableComponent.componentId);
    const item = equipment.getEquipment(itemSlot);
    if (item === undefined)
        return;
    const durability = item.getComponent(ItemDurabilityComponent.componentId);
    if (durability === undefined)
        return;
    durability.damage += damage;
    if (equipment.getEquipment(itemSlot)?.typeId === item.typeId)
        equipment.setEquipment(itemSlot, item);
}
function getBlockTagsFromItemStack(itemStack) {
    try {
        return BlockPermutation.resolve(itemStack.typeId).getTags();
    }
    catch (e) {
        return [];
    }
}

const component$a = {
    onPlayerInteract: (event) => {
        system.runTimeout(() => {
            if (event.player !== undefined) {
                if (isHolding(event.player, "minecraft:bone_meal")) {
                    const growth = event.player.getGameMode() === GameMode.creative
                        ? 999
                        : rand(1, 3, true);
                    const cropData = cropRegistry[event.block.typeId];
                    if (!cropData)
                        return;
                    const currentGrowth = event.block.permutation.getState("pod_farm:growth");
                    if (currentGrowth === cropData.maxGrowth)
                        return;
                    boneMealCrop(event.block, Math.min(cropData.maxGrowth, currentGrowth + growth));
                    consumeItem(event.player, "minecraft:bone_meal");
                }
            }
        }, 1);
    },
};

const setting_definitions = [
    {
        id: "crop_spawning",
        type: "boolean",
        default: true,
    },
    {
        id: "animal_spawning",
        type: "boolean",
        default: true,
    },
    {
        id: "crow_spawning",
        type: "boolean",
        default: true,
    },
    {
        id: "water_breaks_crops",
        type: "boolean",
        default: true,
    },
    {
        id: "mob_trampling",
        type: "boolean",
        default: true,
        onChange: (value) => {
            world
                .getDimension("overworld")
                .runCommand(`event entity @e[family=mob_trampling] pod_farm:${value ? "enable" : "disable"}_block_breaking`);
        },
    },
];
class Settings {
    prefix;
    constructor(prefix) {
        this.prefix = prefix;
        this.load();
    }
    load = () => {
        for (const setting of setting_definitions) {
            const value = world.getDynamicProperty(this.prefix + "_" + setting.id);
            setting.value = value === undefined ? setting.default : value;
        }
    };
    getSettingObject = (settingId) => {
        return setting_definitions.find((v) => v.id === settingId);
    };
    getValue = (settingId) => {
        const setting = this.getSettingObject(settingId);
        if (setting === undefined)
            return undefined;
        const value = setting.value !== undefined ? setting.value : setting.default;
        switch (setting.type) {
            case "enum":
                return setting.options ? setting.options[value] : value;
            default:
                return value;
        }
    };
    setValue = (setting, value) => {
        if (typeof setting === "string") {
            const settingFound = this.getSettingObject(setting);
            if (settingFound === undefined)
                return;
            setting = settingFound;
        }
        setting = setting;
        if (setting === undefined)
            return;
        if (setting.type === "boolean" && typeof value !== "boolean")
            return;
        if (setting.type === "enum" && typeof value !== "number")
            return;
        if (setting.onChange !== undefined)
            setting.onChange(value);
        setting.value = value;
        world.setDynamicProperty(this.prefix + "_" + setting.id, value);
    };
    booleanSwitch = (setting) => {
        this.setValue(setting, !this.getValue(setting));
    };
}

const leavesRegistry = {
    "pod_farm:apple_leaves": {
        sapling: "pod_farm:apple_tree_seeds",
        loot: [{ item: "minecraft:apple", amount: [2, 3], fortune: true }],
    },
    "pod_farm:avocado_leaves": {
        sapling: "pod_farm:avocado_tree_seeds",
        loot: [{ item: "pod_farm:avocado", amount: [2, 3], fortune: true }],
    },
    "pod_farm:lemon_leaves": {
        sapling: "pod_farm:lemon_tree_seeds",
        loot: [{ item: "pod_farm:lemon", amount: [2, 3], fortune: true }],
    },
    "pod_farm:orange_leaves": {
        sapling: "pod_farm:orange_tree_seeds",
        loot: [{ item: "pod_farm:orange", amount: [2, 3], fortune: true }],
    },
    "pod_farm:pear_leaves": {
        sapling: "pod_farm:pear_tree_seeds",
        loot: [{ item: "pod_farm:pear", amount: [2, 3], fortune: true }],
    },
    "pod_farm:peach_leaves": {
        sapling: "pod_farm:peach_tree_seeds",
        loot: [{ item: "pod_farm:peach", amount: [2, 3], fortune: true }],
    },
    "pod_farm:banana_leaf": {
        sapling: "pod_farm:banana_tree_seeds",
        loot: [],
    },
};
const LEAVES_MAX_DIST = 5;
const APPLE_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
            [{ offset: { x: 0, z: -2 }, block: 1 }],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 0 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 1 }, block: 0 }],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 0 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:apple_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:apple_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
        ],
    },
];
const PEAR_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:pear_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:pear_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: -1 }, block: 0 }],
            [{ offset: { x: 0, z: -1 }, block: 0 }],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "up" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 2 },
                { offset: { x: -2, z: 1 }, block: 2 },
                { offset: { x: -2, z: 2 }, block: 2 },
                { offset: { x: -2, z: 3 }, block: 2 },
                { offset: { x: -1, z: -2 }, block: 2 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 2 },
                { offset: { x: 0, z: -3 }, block: 2 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 2 },
                { offset: { x: 0, z: 0 }, block: 2 },
                { offset: { x: 0, z: 1 }, block: 2 },
                { offset: { x: 1, z: -2 }, block: 2 },
                { offset: { x: 1, z: 0 }, block: 2 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 2 },
                { offset: { x: 2, z: 0 }, block: 2 },
                { offset: { x: 2, z: 1 }, block: 2 },
                { offset: { x: 2, z: 2 }, block: 2 },
                { offset: { x: 3, z: 1 }, block: 2 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 2 },
                { offset: { x: -3, z: 2 }, block: 2 },
                { offset: { x: -3, z: 3 }, block: 2 },
                { offset: { x: -2, z: 1 }, block: 2 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 2 },
                { offset: { x: -1, z: -3 }, block: 2 },
                { offset: { x: -1, z: -2 }, block: 2 },
                { offset: { x: -1, z: -1 }, block: 2 },
                { offset: { x: -1, z: 1 }, block: 2 },
                { offset: { x: -1, z: 2 }, block: 2 },
                { offset: { x: -1, z: 3 }, block: 2 },
                { offset: { x: 0, z: -3 }, block: 2 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 2 },
                { offset: { x: 0, z: 0 }, block: 2 },
                { offset: { x: 0, z: 1 }, block: 2 },
                { offset: { x: 1, z: -3 }, block: 2 },
                { offset: { x: 1, z: -2 }, block: 2 },
                { offset: { x: 1, z: -1 }, block: 2 },
                { offset: { x: 1, z: 0 }, block: 2 },
                { offset: { x: 1, z: 1 }, block: 2 },
                { offset: { x: 1, z: 2 }, block: 2 },
                { offset: { x: 2, z: 0 }, block: 2 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 2 },
                { offset: { x: 3, z: 0 }, block: 2 },
                { offset: { x: 3, z: 1 }, block: 2 },
                { offset: { x: 3, z: 2 }, block: 2 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 2 },
                { offset: { x: -2, z: 1 }, block: 2 },
                { offset: { x: -2, z: 2 }, block: 2 },
                { offset: { x: -2, z: 3 }, block: 2 },
                { offset: { x: -1, z: -2 }, block: 2 },
                { offset: { x: -1, z: 2 }, block: 2 },
                { offset: { x: 0, z: -3 }, block: 2 },
                { offset: { x: 0, z: -2 }, block: 2 },
                { offset: { x: 0, z: -1 }, block: 2 },
                { offset: { x: 1, z: -2 }, block: 2 },
                { offset: { x: 1, z: -1 }, block: 2 },
                { offset: { x: 1, z: 1 }, block: 2 },
                { offset: { x: 2, z: 0 }, block: 2 },
                { offset: { x: 2, z: 1 }, block: 2 },
                { offset: { x: 2, z: 2 }, block: 2 },
                { offset: { x: 3, z: 1 }, block: 2 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:pear_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:pear_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 0 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:pear_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:pear_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:pear_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:pear_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 0 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 0 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
                { offset: { x: 3, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 0 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:pear_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:pear_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 0 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
        ],
    },
];
const PEACH_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -3 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:peach_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:peach_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
        ],
    },
];
const AVOCADO_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 2, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 0 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
                { offset: { x: 3, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 0 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:avocado_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:avocado_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 0 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -3 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
        ],
    },
];
const LEMON_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: -3 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 0 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 0 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:lemon_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:lemon_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 0 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 3, z: 1 }, block: 1 },
            ],
        ],
    },
];
const ORANGE_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -3, z: 3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 2 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -3 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -3, z: 1 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 0 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -3 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 0 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 0 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
                { offset: { x: 3, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: 2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 0 },
            ],
            [
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 0 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
                { offset: { x: 2, z: 3 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
            ],
            [
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 0 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: 1, z: -3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 0 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 0 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -2, z: -3 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 1 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -2, z: 3 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 0 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
            ],
            [
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:orange_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:orange_leaves",
                states: { "pod_farm:persistent": false },
            },
        ],
        layers: [
            [
                { offset: { x: -1, z: 1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 1, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 0 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -2 }, block: 1 },
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 0 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: -1, z: 3 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 0 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 0 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 1, z: 3 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 2, z: 2 }, block: 1 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -2, z: -1 }, block: 1 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 2 }, block: 1 },
                { offset: { x: 0, z: 2 }, block: 1 },
                { offset: { x: 0, z: 3 }, block: 1 },
                { offset: { x: 1, z: -2 }, block: 1 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 1 },
                { offset: { x: 1, z: 1 }, block: 1 },
                { offset: { x: 1, z: 2 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 0 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 2, z: 1 }, block: 1 },
                { offset: { x: 3, z: -2 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
            [
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 2, z: -2 }, block: 1 },
                { offset: { x: 2, z: -1 }, block: 1 },
                { offset: { x: 2, z: 0 }, block: 1 },
                { offset: { x: 3, z: -1 }, block: 1 },
            ],
        ],
    },
];
const BANANA_TREES = [
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "east" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "south" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "north" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "west" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -3, z: -3 }, block: 1 },
                { offset: { x: -3, z: 0 }, block: 2 },
                { offset: { x: -2, z: -2 }, block: 3 },
                { offset: { x: -2, z: 2 }, block: 4 },
                { offset: { x: -1, z: 0 }, block: 5 },
                { offset: { x: 0, z: -3 }, block: 3 },
                { offset: { x: 0, z: -1 }, block: 6 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 7 },
                { offset: { x: 1, z: 0 }, block: 8 },
                { offset: { x: 2, z: 0 }, block: 9 },
                { offset: { x: 3, z: 0 }, block: 10 },
                { offset: { x: 3, z: 3 }, block: 9 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 10 },
                { offset: { x: -1, z: -1 }, block: 11 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: -1, z: 1 }, block: 12 },
                { offset: { x: 0, z: -2 }, block: 1 },
                { offset: { x: 0, z: -1 }, block: 3 },
                { offset: { x: 0, z: 0 }, block: 1 },
                { offset: { x: 0, z: 1 }, block: 4 },
                { offset: { x: 0, z: 2 }, block: 4 },
                { offset: { x: 0, z: 3 }, block: 12 },
                { offset: { x: 1, z: -1 }, block: 1 },
                { offset: { x: 1, z: 0 }, block: 10 },
                { offset: { x: 1, z: 1 }, block: 10 },
                { offset: { x: 2, z: -2 }, block: 3 },
                { offset: { x: 2, z: 2 }, block: 10 },
                { offset: { x: 3, z: -3 }, block: 10 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "east" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "south" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "north" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "west" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: 0, z: -3 }, block: 3 },
                { offset: { x: 0, z: -1 }, block: 4 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 5 },
                { offset: { x: 1, z: -1 }, block: 6 },
                { offset: { x: 1, z: 0 }, block: 7 },
                { offset: { x: 2, z: -2 }, block: 8 },
                { offset: { x: 2, z: 2 }, block: 9 },
                { offset: { x: 3, z: 0 }, block: 6 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 10 },
                { offset: { x: -1, z: -1 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 11 },
                { offset: { x: -1, z: 1 }, block: 11 },
                { offset: { x: 0, z: -2 }, block: 10 },
                { offset: { x: 0, z: -1 }, block: 10 },
                { offset: { x: 0, z: 0 }, block: 12 },
                { offset: { x: 0, z: 1 }, block: 9 },
                { offset: { x: 0, z: 2 }, block: 12 },
                { offset: { x: 1, z: 0 }, block: 6 },
                { offset: { x: 1, z: 1 }, block: 8 },
                { offset: { x: 2, z: 0 }, block: 8 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "east" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "south" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "north" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: { "minecraft:cardinal_direction": "west" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: -1, z: -1 }, block: 0 }],
            [{ offset: { x: -1, z: -1 }, block: 0 }],
            [
                { offset: { x: -1, z: -1 }, block: 0 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 2 }, block: 1 },
                { offset: { x: -1, z: -2 }, block: 2 },
                { offset: { x: -1, z: 0 }, block: 3 },
                { offset: { x: 0, z: -1 }, block: 4 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 5 },
                { offset: { x: 1, z: 0 }, block: 6 },
            ],
            [
                { offset: { x: -3, z: -1 }, block: 7 },
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 8 },
                { offset: { x: 0, z: -1 }, block: 9 },
                { offset: { x: 0, z: 0 }, block: 10 },
                { offset: { x: 0, z: 1 }, block: 11 },
                { offset: { x: 1, z: -1 }, block: 12 },
                { offset: { x: 1, z: 0 }, block: 12 },
                { offset: { x: 1, z: 2 }, block: 10 },
                { offset: { x: 2, z: -2 }, block: 8 },
                { offset: { x: 2, z: 0 }, block: 12 },
                { offset: { x: 3, z: 1 }, block: 8 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "south",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "east",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "north",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "west",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: -1, z: 0 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: 0, z: -1 }, block: 1 },
                { offset: { x: 0, z: 0 }, block: 0 },
            ],
            [
                { offset: { x: -3, z: 0 }, block: 2 },
                { offset: { x: -2, z: -2 }, block: 3 },
                { offset: { x: -2, z: 2 }, block: 4 },
                { offset: { x: -1, z: 0 }, block: 5 },
                { offset: { x: -1, z: 1 }, block: 2 },
                { offset: { x: 0, z: -2 }, block: 6 },
                { offset: { x: 0, z: -1 }, block: 3 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 7 },
                { offset: { x: 0, z: 3 }, block: 8 },
                { offset: { x: 1, z: 0 }, block: 9 },
                { offset: { x: 3, z: 0 }, block: 10 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 4 },
                { offset: { x: -1, z: -1 }, block: 6 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: 0, z: 0 }, block: 4 },
                { offset: { x: 0, z: 1 }, block: 11 },
                { offset: { x: 0, z: 2 }, block: 11 },
                { offset: { x: 1, z: -1 }, block: 10 },
                { offset: { x: 1, z: 0 }, block: 12 },
                { offset: { x: 1, z: 1 }, block: 8 },
                { offset: { x: 2, z: -2 }, block: 12 },
                { offset: { x: 2, z: 0 }, block: 12 },
                { offset: { x: 2, z: 2 }, block: 11 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "east",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "south",
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "north",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "west",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: -2, z: 2 }, block: 0 }],
            [{ offset: { x: -2, z: 2 }, block: 0 }],
            [
                { offset: { x: -2, z: 2 }, block: 0 },
                { offset: { x: -1, z: 1 }, block: 0 },
            ],
            [{ offset: { x: -1, z: 1 }, block: 0 }],
            [{ offset: { x: -1, z: 1 }, block: 0 }],
            [
                { offset: { x: -3, z: 0 }, block: 1 },
                { offset: { x: -2, z: -2 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: 0, z: -3 }, block: 3 },
                { offset: { x: 0, z: -2 }, block: 4 },
                { offset: { x: 0, z: -1 }, block: 5 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 6 },
                { offset: { x: 0, z: 2 }, block: 7 },
                { offset: { x: 0, z: 3 }, block: 8 },
                { offset: { x: 1, z: 0 }, block: 9 },
            ],
            [
                { offset: { x: -2, z: 0 }, block: 10 },
                { offset: { x: -2, z: 2 }, block: 10 },
                { offset: { x: -1, z: -1 }, block: 10 },
                { offset: { x: -1, z: 0 }, block: 1 },
                { offset: { x: -1, z: 1 }, block: 7 },
                { offset: { x: 0, z: -1 }, block: 3 },
                { offset: { x: 0, z: 0 }, block: 8 },
                { offset: { x: 0, z: 1 }, block: 8 },
                { offset: { x: 1, z: -1 }, block: 4 },
                { offset: { x: 1, z: 0 }, block: 11 },
                { offset: { x: 1, z: 1 }, block: 7 },
                { offset: { x: 2, z: -2 }, block: 11 },
                { offset: { x: 2, z: 0 }, block: 12 },
                { offset: { x: 2, z: 2 }, block: 8 },
                { offset: { x: 3, z: 0 }, block: 11 },
            ],
        ],
    },
    {
        blocksUsed: [
            {
                typeId: "pod_farm:banana_log",
                states: { "minecraft:facing_direction": "down" },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "east",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "south",
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "north",
                },
            },
            {
                typeId: "pod_farm:banana_cluster",
                states: {
                    "minecraft:cardinal_direction": "west",
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "south",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "east",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "upper",
                    "minecraft:cardinal_direction": "north",
                    "pod_farm:persistent": false,
                },
            },
            {
                typeId: "pod_farm:banana_leaf",
                states: {
                    "pod_farm:half": "lower",
                    "minecraft:cardinal_direction": "west",
                    "pod_farm:persistent": false,
                },
            },
        ],
        layers: [
            [{ offset: { x: -1, z: 1 }, block: 0 }],
            [{ offset: { x: -1, z: 1 }, block: 0 }],
            [{ offset: { x: 0, z: 0 }, block: 0 }],
            [
                { offset: { x: -2, z: 0 }, block: 1 },
                { offset: { x: -1, z: 0 }, block: 2 },
                { offset: { x: 0, z: -2 }, block: 3 },
                { offset: { x: 0, z: -1 }, block: 4 },
                { offset: { x: 0, z: 0 }, block: 0 },
                { offset: { x: 0, z: 1 }, block: 5 },
                { offset: { x: 1, z: 0 }, block: 6 },
                { offset: { x: 2, z: 0 }, block: 7 },
            ],
            [
                { offset: { x: -2, z: -2 }, block: 8 },
                { offset: { x: -2, z: 2 }, block: 9 },
                { offset: { x: -1, z: -1 }, block: 3 },
                { offset: { x: -1, z: 0 }, block: 10 },
                { offset: { x: -1, z: 1 }, block: 11 },
                { offset: { x: 0, z: -1 }, block: 8 },
                { offset: { x: 0, z: 0 }, block: 12 },
                { offset: { x: 0, z: 1 }, block: 11 },
                { offset: { x: 1, z: -1 }, block: 7 },
                { offset: { x: 1, z: 0 }, block: 12 },
                { offset: { x: 1, z: 2 }, block: 9 },
                { offset: { x: 2, z: -2 }, block: 8 },
            ],
        ],
    },
];
const saplingRegistry = {
    "pod_farm:apple_tree_sapling": APPLE_TREES,
    "pod_farm:pear_tree_sapling": PEAR_TREES,
    "pod_farm:peach_tree_sapling": PEACH_TREES,
    "pod_farm:lemon_tree_sapling": LEMON_TREES,
    "pod_farm:orange_tree_sapling": ORANGE_TREES,
    "pod_farm:avocado_tree_sapling": AVOCADO_TREES,
    "pod_farm:banana_tree_sapling": BANANA_TREES,
};

const VERSION = "1.1.0";
const VERSION_HISTORY = [
    "1.1.0",
    "1.0.12",
    "1.0.11",
    "1.0.10",
    "1.0.9",
    "1.0.8",
];
const settings = new Settings("pod_farm");
const BIOME_GROUPS = {
    biome_1: [
        {
            treeTypes: APPLE_TREES,
        },
        {
            treeTypes: PEAR_TREES,
        },
    ],
    biome_2: [
        { treeTypes: PEACH_TREES },
        { block: "pod_farm:raspberry_bush" },
        { block: "pod_farm:strawberry_bush" },
    ],
    biome_3: [
        { treeTypes: BANANA_TREES },
        { treeTypes: AVOCADO_TREES },
        { block: "pod_farm:coffee_plant" },
        { block: "pod_farm:tea_plant" },
    ],
    biome_4: [
        { block: "pod_farm:blackberry_bush" },
        { block: "pod_farm:blueberry_bush" },
    ],
    biome_5: [{ block: "pod_farm:cranberry_bush" }],
    biome_6: [{ block: "pod_farm:coconut" }],
    biome_7: [{ block: "pod_farm:grape_vine" }],
    biome_8: [
        { treeTypes: ORANGE_TREES },
        { treeTypes: LEMON_TREES },
        { block: "pod_farm:pineapple_plant" },
    ],
};

const component$9 = {
    onTick: (event) => {
        try {
            if (settings.getValue("water_breaks_crops")?.valueOf() === false)
                return;
            const blocks = [
                event.block.above(),
                event.block.north(),
                event.block.east(),
                event.block.south(),
                event.block.west(),
            ];
            for (const block of blocks) {
                if (block?.isLiquid) {
                    breakCrop(event.block);
                    return;
                }
            }
        }
        catch (e) { }
    },
};

const component$8 = {
    onPlayerDestroy: (event) => {
        onCropBreak(event.block, event.destroyedBlockPermutation, event.player);
    },
};

const HALF_BLOCK_ITEMS = ["pod_farm:banana_leaf"];
let registry = [];
const component$7 = {
    beforeOnPlayerPlace: (event) => {
        const foundMatch = registry.find((v) => v.tick === system.currentTick &&
            vectorMatches(v.location, event.block.location));
        if (foundMatch !== undefined) {
            let newState = foundMatch.faceLocation.y >= 0.5 ? "upper" : "lower";
            if (foundMatch.faceLocation.y === 1)
                newState = "lower";
            if (foundMatch.faceLocation.y === 0)
                newState = "upper";
            event.permutationToPlace = event.permutationToPlace.withState("pod_farm:half", newState);
        }
    },
};
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (HALF_BLOCK_ITEMS.includes(event.itemStack.typeId)) {
        registry = registry.filter((v) => v.tick === system.currentTick);
        const blockReplaced = getReplacedBlockByBlockFace(event.block, event.blockFace);
        if (blockReplaced === undefined)
            return;
        registry.push({
            tick: system.currentTick,
            faceLocation: event.faceLocation,
            location: blockReplaced.location,
        });
    }
});

const rotation = ["north", "east", "south", "west"];
const component$6 = {
    beforeOnPlayerPlace: (event) => {
        let supportBlock;
        switch (event.permutationToPlace.getState("minecraft:cardinal_direction")) {
            case "north":
                supportBlock = event.block.north();
                break;
            case "east":
                supportBlock = event.block.east();
                break;
            case "south":
                supportBlock = event.block.south();
                break;
            case "west":
                supportBlock = event.block.west();
                break;
        }
        if (!supportBlock?.hasTag("pod_farm:hold_banana_cluster")) {
            const newSupport = [
                event.block.north(),
                event.block.east(),
                event.block.south(),
                event.block.west(),
            ].findIndex((v) => v?.hasTag("pod_farm:hold_banana_cluster"));
            if (newSupport === -1) {
                event.cancel = true;
                return;
            }
            event.permutationToPlace = event.permutationToPlace.withState("minecraft:cardinal_direction", rotation[newSupport]);
        }
    },
};

const component$5 = {
    onRandomTick: async (event) => {
        try {
            const distance = event.block.permutation.getState("pod_farm:distance");
            if (distance === LEAVES_MAX_DIST)
                return;
            const currentGrowth = event.block.permutation.getState("pod_farm:growth");
            if (currentGrowth === 0 && !(await canGrowFruits(event.block)))
                return;
            if (currentGrowth === 3)
                return;
            event.block.setPermutation(event.block.permutation.withState("pod_farm:growth", currentGrowth + 1));
        }
        catch (e) { }
    },
};
async function canGrowFruits(block) {
    for (let x = -1; x < 2; x++) {
        for (let y = -1; y < 2; y++) {
            for (let z = -1; z < 2; z++) {
                if (x === 0 && y === 0 && z === 0)
                    continue;
                const query = block.dimension.getBlock(addVector(block.location, { x: x, y: y, z: z }));
                if (query === undefined || query?.isAir)
                    continue;
                if (query.typeId === block.typeId) {
                    if (query.permutation.getState("pod_farm:growth") !== 0)
                        return false;
                }
            }
        }
    }
    return true;
}

const component$4 = {
    onPlayerInteract: (event) => {
        const data = leavesRegistry[event.block.typeId];
        if (data === undefined)
            return;
        if (event.player === undefined)
            return;
        const currentGrowth = event.block.permutation.getState("pod_farm:growth");
        //Prevention to disallow picking when the crop was just bone mealed.
        system.runTimeout(() => {
            if (event.block.permutation.getState("pod_farm:growth") !== currentGrowth)
                return;
            //Prevention end
            if (currentGrowth === 3) {
                event.block.setPermutation(event.block.permutation.withState("pod_farm:growth", 0));
                world.playSound("block.sweet_berry_bush.pick", event.block.center());
                spawnLoot(event.dimension, addVector(event.block.center(), { y: -0.5 }), data.loot);
            }
        }, 2);
    },
};

const SAPLING_RATES = [0.05, 0.0625, 0.0833, 0.1];
const STICK_RATES = [0.02, 0.0222, 0.025, 0.0333];
function onLeavesBreak(block, permutation = block.permutation, player) {
    const data = leavesRegistry[permutation.type.id];
    if (data === undefined)
        return;
    const growth = permutation.getState("pod_farm:growth");
    if (growth === 3)
        spawnLoot(block.dimension, block.center(), data.loot, player);
    if (player) {
        if (player.getGameMode() === GameMode.creative)
            return;
        if (isHolding(player, "minecraft:shears") /* ||
       hasEnchantment(
          getItemInSlot(player, EquipmentSlot.Mainhand),
          "minecraft:silk_touch"
        ) */ //Apparently silk touch just works on any block, so no need for this
        ) {
            block.dimension.spawnItem(new ItemStack(permutation.type.id), block.center());
            return;
        }
    }
    const fortune = player !== undefined ? fortuneLevelOnHoe(player) : 0;
    if (SAPLING_RATES[fortune] >= rand())
        block.dimension.spawnItem(new ItemStack(data.sapling), block.center());
    for (let i = 0; i < 2; i++) {
        if (STICK_RATES[fortune] >= rand())
            block.dimension.spawnItem(new ItemStack("minecraft:stick"), block.center());
    }
}
function breakLeaves(block, player) {
    onLeavesBreak(block, block.permutation, player);
    breakBlockSafely(block);
}
function attemptPlaceTree(block, treeTypes, attempts = 3) {
    if (placeTree(block, randomSelection(treeTypes)))
        return true;
    if (attempts === 1)
        return false;
    return attemptPlaceTree(block, treeTypes, attempts - 1);
}
function placeTree(root, tree) {
    if (!validateTreeLocation(root, tree))
        return false;
    if (root.hasTag("pod_farm:sapling"))
        root.setPermutation(BlockPermutation.resolve("air"));
    placeLayer(tree, root.below(), tree.layers[0]);
    for (const layer of tree.layers) {
        placeLayer(tree, root, layer);
        root = root.above();
    }
    return true;
}
function placeLayer(tree, root, layer) {
    for (const element of layer) {
        const block = root.offset({ ...element.offset, y: 0 });
        if (block?.isAir) {
            const permutation = BlockPermutation.resolve(tree.blocksUsed[element.block].typeId, tree.blocksUsed[element.block].states);
            block.setPermutation(permutation);
        }
    }
}
function validateTreeLocation(root, tree) {
    for (const layer of tree.layers) {
        for (const element of layer) {
            if (element.offset.x === 0 && element.offset.z === 0)
                continue;
            const block = root.offset({ ...element.offset, y: 0 });
            if (!block?.isAir)
                return false;
        }
        root = root.above();
    }
    return true;
}

const component$3 = {
    onRandomTick: async (event) => {
        try {
            updateDecay(event.block);
        }
        catch (e) { }
    },
};
async function updateDecay(block, neighbourQueue = true) {
    if (block.dimension.getPlayers({ location: block.location, maxDistance: 40 })
        .length === 0)
        return;
    const neighbours = [];
    const state = block.permutation.getState("pod_farm:distance");
    let lowest = LEAVES_MAX_DIST - 1;
    for (let x = -1; x < 2; x++) {
        for (let y = -1; y < 2; y++) {
            for (let z = -1; z < 2; z++) {
                if (x === 0 && y === 0 && z === 0)
                    continue;
                const query = block.dimension.getBlock(addVector(block.location, { x: x, y: y, z: z }));
                if (query === undefined || query?.isAir)
                    continue;
                if (query.typeId === block.typeId) {
                    const d = query.permutation.getState("pod_farm:distance");
                    if (neighbourQueue)
                        neighbours.push(query);
                    if (d < lowest)
                        lowest = d;
                }
                if (query.hasTag(block.typeId))
                    lowest = 0;
            }
        }
    }
    lowest++;
    if (lowest === LEAVES_MAX_DIST && state === LEAVES_MAX_DIST) {
        if (block.permutation.getState("pod_farm:persistent") === true)
            return;
        decay(block);
    }
    else {
        if (block.isValid() && lowest !== state) {
            if (!block.isAir)
                block.setPermutation(block.permutation.withState("pod_farm:distance", lowest));
            if (neighbourQueue)
                updateDecayNeighbour(neighbours);
        }
    }
}
async function updateDecayNeighbour(blocks) {
    for (const block of blocks) {
        system.runTimeout(async () => {
            if (block.isValid())
                updateDecay(block, false);
        }, rand(20, 200, true));
    }
}
function decay(block) {
    onLeavesBreak(block);
    breakBlockSafely(block, false);
}

const component$2 = {
    onPlayerDestroy: (event) => {
        onLeavesBreak(event.block, event.destroyedBlockPermutation, event.player);
    },
};

const component$1 = {
    onRandomTick: (event) => {
        if (0.33 >= rand()) {
            const treeTypes = saplingRegistry[event.block.typeId];
            if (treeTypes === undefined)
                return;
            attemptPlaceTree(event.block, treeTypes);
        }
    },
};

const component = {
    onPlayerInteract: (event) => {
        system.runTimeout(() => {
            if (event.player !== undefined) {
                if (isHolding(event.player, "minecraft:bone_meal")) {
                    const treeTypes = saplingRegistry[event.block.typeId];
                    if (treeTypes === undefined)
                        return;
                    if (event.player.getGameMode() === GameMode.creative ? 1 : 0.2 >= rand()) {
                        attemptPlaceTree(event.block, treeTypes, 2);
                    }
                    consumeItem(event.player, "minecraft:bone_meal");
                    world.playSound("item.bone_meal.use", event.block.center());
                    event.dimension.spawnParticle("minecraft:crop_growth_emitter", event.block.center());
                }
            }
        }, 1);
    },
};

world.beforeEvents.worldInitialize.subscribe((event) => {
    event.blockComponentRegistry.registerCustomComponent("pod_farm:crop_pick", component$c);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:crop_grow", component$b);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:crop_bone_meal", component$a);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:crop_water_break", component$9);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:crop_break", component$8);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:half_block", component$7);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:banana_cluster", component$6);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:leaves_grow", component$5);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:leaves_pick", component$4);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:leaves_decay", component$3);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:leaves_break", component$2);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:sapling_grow", component$1);
    event.blockComponentRegistry.registerCustomComponent("pod_farm:sapling_bone_meal", component);
});

const SUSPICIOUS_EFFECTS = [
    "hunger",
    "nausea",
    "slowness",
    "weakness",
    "regeneration",
    "night_vision",
    "instant_health",
    "resistance",
];
const UNHEALTHY_EFFECTS = [
    "poison",
    "blindness",
    "hunger",
    "nausea",
    "slowness",
    "mining_fatigue",
    "instant_damage",
    "weakness",
];
world.afterEvents.itemCompleteUse.subscribe((event) => {
    const { itemStack, source } = event;
    /*
    Stats Tracking Code Start - Custom Food Consumed
    */
    if (itemStack.typeId.startsWith("pod_farm:"))
        incrementStat("items_consumed", 1);
    /*
    Stats Tracking Code End
    */
    if (itemStack.hasTag("pod_farm:suspicious")) {
        source.addEffect(randomSelection(SUSPICIOUS_EFFECTS), TicksPerSecond * 10);
    }
    if (itemStack.hasTag("pod_farm:unhealthy")) {
        source.addEffect(randomSelection(UNHEALTHY_EFFECTS), TicksPerSecond * 10);
    }
    switch (itemStack.typeId) {
        case "pod_farm:golden_apple_juice":
            source.addEffect("regeneration", TicksPerSecond * 10, { amplifier: 3 });
            source.addEffect("absorption", TicksPerSecond * 240, { amplifier: 1 });
            source.addEffect("fire_resistance", TicksPerSecond * 180, {
                amplifier: 0,
            });
            break;
        case "pod_farm:pufferfish_sushi":
            source.addEffect("hunger", TicksPerSecond * 15, { amplifier: 2 });
            source.addEffect("poison", TicksPerSecond * 60, { amplifier: 1 });
            source.addEffect("nausea", TicksPerSecond * 15, { amplifier: 1 });
            break;
        case "pod_farm:cup_of_coffee":
        case "pod_farm:cup_of_tea":
        case "pod_farm:cup_of_ginger_tea":
        case "pod_farm:cup_of_hot_chocolate":
            source.addEffect("speed", TicksPerSecond * 30, { amplifier: 1 });
            break;
        case "pod_farm:oat_milk":
            source.runCommand("effect @s clear");
            break;
        case "pod_farm:chili":
            source.applyDamage(1, { cause: EntityDamageCause.temperature });
            break;
    }
});

const fences = [
    "minecraft:oak_fence",
    "minecraft:spruce_fence",
    "minecraft:birch_fence",
    "minecraft:jungle_fence",
    "minecraft:acacia_fence",
    "minecraft:dark_oak_fence",
    "minecraft:mangrove_fence",
    "minecraft:cherry_fence",
    "minecraft:bamboo_fence",
    "minecraft:crimson_fence",
    "minecraft:warped_fence",
    "minecraft:nether_brick_fence",
];
const cardinalOfPumpkin = (block) => {
    if (block.permutation.matches("carved_pumpkin", {
        "minecraft:cardinal_direction": "north",
    }))
        return "north";
    if (block.permutation.matches("carved_pumpkin", {
        "minecraft:cardinal_direction": "south",
    }))
        return "south";
    if (block.permutation.matches("carved_pumpkin", {
        "minecraft:cardinal_direction": "east",
    }))
        return "east";
    if (block.permutation.matches("carved_pumpkin", {
        "minecraft:cardinal_direction": "west",
    }))
        return "west";
    return false;
};
world.afterEvents.playerPlaceBlock.subscribe((event) => {
    const { block, dimension } = event;
    if (block.hasTag("pod_farm:crop")) {
        /*
        Stats Tracking Code Start - Scarecrows Built
        */
        incrementStat("crops_placed", 1);
        /*
        Stats Tracking Code End
        */
    }
    // Guards
    if (block.typeId !== "minecraft:carved_pumpkin")
        return;
    if (block.below()?.typeId !== "minecraft:hay_block")
        return;
    if (!fences.includes(block.below(2)?.typeId || ""))
        return;
    const direction = cardinalOfPumpkin(block);
    if (((direction === "north" || direction === "south") &&
        fences.includes(block.below()?.east()?.typeId || "") &&
        fences.includes(block.below()?.west()?.typeId || "")) ||
        ((direction === "east" || direction === "west") &&
            fences.includes(block.below()?.north()?.typeId || "") &&
            fences.includes(block.below()?.south()?.typeId || ""))) {
        const location = addVector(block.bottomCenter(), { y: -2 });
        /*
        Stats Tracking Code Start - Scarecrows Built
        */
        incrementStat("scarecrows_built", 1);
        /*
        Stats Tracking Code End
        */
        handleAsync(Promise.all([
            dimension.runCommandAsync(`execute positioned ${location.x} ${location.y + 1} ${location.z} run fill ~ ~-1 ~ ~ ~1 ~ air`),
            dimension.runCommandAsync(`execute positioned ${location.x} ${location.y + 1} ${location.z} run fill ${direction === "north" || direction === "south"
                ? "~1 ~ ~ ~-1 ~ ~"
                : "~ ~ ~1 ~ ~ ~-1"} air`),
            dimension.runCommandAsync(`summon pod_farm:scarecrow ${location.x} ${location.y} ${location.z} ${direction === "north"
                ? 180
                : direction === "south"
                    ? 0
                    : direction === "east"
                        ? 270
                        : 90} 0`),
        ]), "spawn scarecrow");
    }
});

world.afterEvents.playerBreakBlock.subscribe(async (event) => {
    if (event.brokenBlockPermutation.matches("tallgrass")) {
        if (Math.floor(Math.random() * 5) === 0) {
            const crop = farmland_only_crops[Math.floor(Math.random() * farmland_only_crops.length)];
            event.player.dimension.spawnItem(new ItemStack(crop + (crop === "pod_farm:sweet_potato" ? "" : "_seeds"), 1), event.block.location);
            /*
          Stats Tracking Code Start - Seeds Collected
          */
            incrementStat("seeds_collected", 1);
            /*
          Stats Tracking Code End
          */
        }
    }
});

world.afterEvents.playerSpawn.subscribe((event) => {
    const { initialSpawn, player } = event;
    if (!initialSpawn)
        return;
    if (player.getDynamicProperty("received_cookbook") === undefined) {
        player.setDynamicProperty("received_cookbook", true);
        player.dimension.spawnItem(new ItemStack("pod_farm:cookbook"), player.location);
    }
    const version = player.getDynamicProperty("pod_farm_version");
    if (version === undefined) {
        player.setDynamicProperty("pod_farm_version", VERSION);
        if (player.hasTag("pod_farm_received_guide")) {
            player.removeTag("pod_farm_received_guide");
            player.sendMessage({
                translate: "pod_farm.announce_update",
                with: [VERSION],
            });
            return;
        }
        player.dimension.spawnItem(new ItemStack("pod_farm:guide"), player.location);
    }
    else if (version !== VERSION) {
        if (VERSION_HISTORY.indexOf(version) >
            VERSION_HISTORY.indexOf("1.0.16")) {
            system.runTimeout(() => {
                showPage(player, { text: `Farming Add-On` }, {
                    text: `Welcome to FARMING: The Block Update
We've updated all crops in our add-on to be fully block-based. If you experience issues with lag when creating larger farms, this should be resolved now. Once you get near them, all crops, bushes, and plants will automatically become their new block variant! Trees will, however, not be converted. To convert it, simply break your old tree, and it will drop the saplings for the new tree! Please note that the old trees will not continue to grow. 
    
Bushes, Plants and Trees will now be generated using an algorithm that remembers which chunks you have been to. Bushes, plants, and trees will only be generated in unexplored chunks, and no new trees or crops will appear in chunks once they are explored. Please note that the whole world is considered unexplored, and trees will be generated in areas you have already been to before updating to this version. 
    
Our crop spawning setting will still disable crops and tree spawning. Ensure you update all crops and trees to blocks as soon as possible, as entity-based crops will be removed from all future updates.

You can find the full changelog in your Farming Book.`,
                }, [{ text: `Close` }]);
            }, 150);
        }
        player.setDynamicProperty("pod_farm_version", VERSION);
        player.sendMessage({
            translate: "pod_farm.announce_update",
            with: [VERSION],
        });
    }
});

/*
const buttonExample = {
  translation_key: "pod_farm.guide.main.button.0",
  icon_path: "textures/items/iron_ingot", //can be undefined, button will have no icon then.
  action: showPage("main", 0, []), //can be any function or undefined. If undefined, the button will close the menu.
};
*/
const showGuidePage = (player, pageName, entries, buttons) => {
    if (!buttons || !buttons.length) {
        log(`Failed to show Page[${pageName}]: Requires Button.`);
        return;
    }
    const body = { rawtext: [] };
    for (let i = 0; i < entries; i++) {
        body.rawtext?.push({
            translate: `pod_farm.guide.${pageName}.${i}`,
            with: ["\n"],
        });
        body.rawtext?.push({ text: "§r\n" });
    }
    const form = new ActionFormData();
    form.title({ rawtext: [{ translate: `pod_farm.guide.${pageName}.title` }] });
    form.body(body);
    for (const button of buttons) {
        form.button(button.text, button.icon);
    }
    form.show(player).then((response) => {
        if (response.canceled || response.selection === undefined)
            return;
        const action = buttons[response.selection].action;
        if (!action)
            return;
        action(player);
    });
};
/**
 *
 * @param {Player} player
 */
const showSettingsPage = async (player) => {
    const form = new ActionFormData();
    form.title({ translate: "pod_farm.settings.title" });
    form.body({ translate: "pod_farm.settings.body", with: ["\n"] });
    for (const setting of setting_definitions) {
        form.button({
            rawtext: [{ translate: `pod_farm.setting.${setting.id}` }],
        }, `textures/podcrash/farm/guide/${settings.getValue(setting.id) ? "on" : "off"}_button.png`);
    }
    const response = await form.show(player);
    if (!response || response.canceled || response.selection === undefined)
        return;
    const setting = setting_definitions[response.selection];
    world.sendMessage({
        translate: `pod_farm.settings.${settings.getValue(setting.id) ? "disabled" : "enabled"}`,
        with: [player.name, setting.id],
    });
    settings.booleanSwitch(setting.id);
    showSettingsPage(player);
};

const BUTTONS = [
    {
        text: { translate: "pod_farm.guide.animals.title" },
        icon: "textures/podcrash/farm/guide/animals_icon.png",
        action: (player) => {
            showGuidePage(player, "animals", 19, [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "pod_farm.guide.crops.title" },
        icon: "textures/podcrash/farm/blocks/trees/orange_sapling.png",
        action: (player) => {
            showGuidePage(player, "crops", 37, [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "pod_farm.guide.crafting.title" },
        icon: "textures/blocks/crafting_table_front.png",
        action: (player) => {
            showGuidePage(player, "crafting", 46, [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "pod_farm.guide.kitchenware.title" },
        icon: "textures/podcrash/farm/items/plate.png",
        action: (player) => {
            showGuidePage(player, "kitchenware", 23, [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "item.pod_farm:cookbook" },
        icon: "textures/podcrash/farm/items/cookbook.png",
        action: (player) => {
            openCookbook(player, new ItemStack("pod_farm:guide"), () => {
                showMainPage(player);
            });
        },
    },
    {
        text: { translate: "pod_farm.guide.other.title" },
        icon: "textures/podcrash/farm/items/watering_can.png",
        action: (player) => {
            showGuidePage(player, "other", 11, [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "pod_farm.guide.changelog.title" },
        icon: "textures/podcrash/farm/items/guide.png",
        action: (player) => {
            const body = new RawtextBuilder();
            body.pushLine({
                translate: "pod_farm.guide.changelog.body",
                with: [VERSION],
            });
            body.pushLine();
            for (const version of VERSION_HISTORY) {
                body.pushLine({
                    translate: "pod_farm.guide.changelog.subtitle",
                    with: [version],
                });
                body.pushLine();
                body.pushLine({
                    translate: `pod_farm.guide.changelog.${version}`,
                    with: ["\n"],
                });
                body.pushLine();
                body.pushLine();
            }
            showPage(player, "pod_farm.guide.changelog.title", body.build(), [
                {
                    text: { translate: "pod_farm.guide.common.back_button" },
                    action: (player) => showMainPage(player),
                },
            ]);
        },
    },
    {
        text: { translate: "pod_farm.settings.title" },
        icon: "textures/blocks/command_block.png",
        action: (player) => {
            showSettingsPage(player);
        },
    },
    {
        text: { translate: "pod_farm.guide.common.exit_button" },
    },
];
const showMainPage = (player) => {
    showGuidePage(player, "main", 5, BUTTONS);
};
world.afterEvents.itemUse.subscribe((event) => {
    if (event.itemStack.typeId === "pod_farm:guide") {
        showMainPage(event.source);
    }
});

world.afterEvents.blockExplode.subscribe((event) => {
    if (event.explodedBlockPermutation.hasTag("pod_farm:crop")) {
        onCropBreak(event.block, event.explodedBlockPermutation);
    }
    if (event.explodedBlockPermutation.hasTag("pod_farm:leaves")) {
        onLeavesBreak(event.block, event.explodedBlockPermutation);
    }
});

//These have to be in order with the foods in the plate animation controller, else they will be displayed wrongly
const FOODS_3D = [
    "pod_farm:tomato_soup",
    "pod_farm:potato_soup",
    "pod_farm:sweet_potato_soup",
    "minecraft:beetroot_soup",
    "minecraft:suspicious_stew",
    "minecraft:mushroom_stew",
    "minecraft:rabbit_stew",
    "pod_farm:vegetable_soup",
    "pod_farm:chicken_noodle_soup",
    "pod_farm:tomato_chili_pasta",
    "pod_farm:tomato_onion_pasta",
    "pod_farm:spinach_pasta",
    "pod_farm:broccoli_cheese_pasta",
    "pod_farm:rice_porridge",
    "pod_farm:oat_porridge",
    "pod_farm:salad",
    "pod_farm:pizza",
    "pod_farm:hawaiian_pizza",
    "pod_farm:strawberry_tart",
    "pod_farm:rhubarb_pie",
    "pod_farm:raspberry_pie",
    "pod_farm:blueberry_pie",
    "pod_farm:grape_pie",
    "pod_farm:blackberry_pie",
    "minecraft:pumpkin_pie",
    "pod_farm:peach_pie",
    "minecraft:cake",
    "pod_farm:hamburger",
    "pod_farm:poultry_burger",
    "pod_farm:fish_burger",
    "pod_farm:cheeseburger",
    "pod_farm:turkey_sandwich",
    "pod_farm:chicken_sandwich",
    "pod_farm:breakfast_sandwich",
    "pod_farm:pb_j_sandwich",
    "pod_farm:pb_j_sandwich1",
    "pod_farm:pb_j_sandwich2",
    "pod_farm:pb_j_sandwich3",
    "pod_farm:pb_j_sandwich4",
    "pod_farm:pb_j_sandwich5",
    "pod_farm:pb_j_sandwich6",
    "pod_farm:pb_j_sandwich7",
    "pod_farm:apple_pie",
    "pod_farm:blt",
];
const NON_TAGGED_FOODS = ["minecraft:cake", "minecraft:suspicious_stew"];
let itemUseData = [];
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.itemStack.typeId === "pod_farm:plate") {
        const { block, blockFace } = event;
        let replacedBlock = undefined;
        switch (blockFace) {
            case Direction.Down:
                replacedBlock = block.below(2);
                break;
            case Direction.North:
                replacedBlock = block.north();
                break;
            case Direction.East:
                replacedBlock = block.east();
                break;
            case Direction.South:
                replacedBlock = block.south();
                break;
            case Direction.West:
                replacedBlock = block.west();
                break;
            case Direction.Up:
                replacedBlock = block.above();
                break;
        }
        if (replacedBlock !== undefined) {
            if (block.dimension
                .getEntitiesAtBlockLocation(replacedBlock)
                .some((v) => v.typeId === "pod_farm:plate"))
                event.cancel = true;
        }
    }
});
world.afterEvents.itemUse.subscribe((event) => {
    if (!event.itemStack.hasTag("minecraft:is_food") &&
        !NON_TAGGED_FOODS.includes(event.itemStack.typeId))
        return;
    itemUseData = itemUseData.filter((v) => system.currentTick - v.tick < 5);
    itemUseData.push({
        tick: system.currentTick,
        event: event,
    });
});
world.afterEvents.entitySpawn.subscribe((event) => {
    if (event.entity.typeId === "pod_farm:plate") {
        world.playSound("dig.bone_block", event.entity.location, {
            pitch: 1.3 + Math.random() * 0.2,
        });
        if (event.entity.dimension.getBlock(event.entity.location)?.below()?.isAir)
            event.entity.triggerEvent("pod_farm:break");
    }
});
system.runInterval(async () => {
    const promises = [];
    for (const player of world.getAllPlayers()) {
        promises.push(validatePlates(player));
    }
    Promise.all(promises);
}, 200);
const validatePlates = async (player) => {
    for (const plate of player.dimension.getEntities({
        location: player.location,
        maxDistance: 5,
        closest: 4,
        type: "pod_farm:plate",
    })) {
        const block = plate.dimension.getBlock(plate.location);
        if (!block?.isAir || block.below()?.isAir) {
            if (plate.hasTag("pod_farm.Filled"))
                popItem(plate);
            plate.triggerEvent("pod_farm:break");
        }
    }
};
world.afterEvents.dataDrivenEntityTrigger.subscribe((event) => {
    if (event.entity.typeId === "pod_farm:plate") {
        if (event.eventId === "pod_farm:handlePunch") {
            if (event.entity.hasTag("pod_farm.Filled")) {
                event.entity.runCommand(`replaceitem entity @s slot.weapon.mainhand 0 air`);
                world.playSound("block.itemframe.remove_item", event.entity.location);
                popItem(event.entity);
                event.entity.removeTag("pod_farm.Filled");
            }
            else {
                world.playSound("dig.bone_block", event.entity.location, {
                    pitch: 1.3 + Math.random() * 0.2,
                });
                event.entity.triggerEvent("pod_farm:break");
            }
        }
        if (event.eventId === "pod_farm:handleInteract") {
            const tick = system.currentTick;
            system.runTimeout(() => {
                if (!event.entity.isValid())
                    return;
                const players = event.entity.dimension.getPlayers({
                    location: event.entity.location,
                    maxDistance: 3,
                    closest: 10,
                });
                const match = itemUseData.find((v) => v.tick === tick && players.find((p) => p.id === v.event.source.id));
                if (match !== undefined) {
                    if (event.entity.hasTag("pod_farm.Filled"))
                        popItem(event.entity);
                    const foodIndex = FOODS_3D.findIndex((v) => v === match.event.itemStack.typeId);
                    if (foodIndex === -1) {
                        event.entity.runCommand(`replaceitem entity @s slot.weapon.mainhand 0 ${match.event.itemStack.typeId}`);
                    }
                    else {
                        event.entity.setProperty("pod_farm:food", foodIndex + 1);
                        event.entity.runCommand(`replaceitem entity @s slot.weapon.mainhand 0 air`);
                    }
                    world.playSound("block.itemframe.add_item", event.entity.location);
                    event.entity.addTag(`pod_farm.Food:${match.event.itemStack.typeId}`);
                    event.entity.addTag("pod_farm.Filled");
                    match.event.source.runCommand(`clear @s ${match.event.itemStack.typeId} 0 1`);
                }
            }, 1);
        }
    }
});
const popItem = (plate) => {
    const tag = plate.getTags().find((v) => v.startsWith("pod_farm.Food:"));
    if (tag === undefined)
        return;
    plate.setProperty("pod_farm:food", 0);
    plate.dimension.spawnItem(new ItemStack(tag.replace("pod_farm.Food:", "")), plate.location);
    plate.removeTag(tag);
};

world.afterEvents.itemUseOn.subscribe((event) => {
    if (event.block.permutation.matches("minecraft:composter")) {
        if (event.itemStack.hasTag("pod_farm:compostable") ||
            getBlockTagsFromItemStack(event.itemStack).includes("pod_farm:compostable")) {
            const currentLevel = event.block.permutation.getState("composter_fill_level");
            if (currentLevel === 8)
                return;
            if (0.5 >= Math.random()) {
                event.block.setPermutation(event.block.permutation.withState("composter_fill_level", currentLevel + 1));
                world.playSound("block.composter.fill_success", event.block.center(), {
                    volume: 1.3,
                });
            }
            else {
                world.playSound("block.composter.fill", event.block.center(), {
                    volume: 1.3,
                    pitch: 0.8,
                });
            }
            world.playSound("item.bone_meal.use", event.block.center(), {
                volume: 1,
                pitch: 0.9 + Math.random() * 0.2,
            });
            event.block.dimension.spawnParticle("minecraft:crop_growth_emitter", event.block.center());
            event.source.runCommand(`clear @s ${event.itemStack.typeId} 0 1`);
        }
    }
});

const placeCooldown$1 = new TimerUtil();
const GROWTH_CHANCE = 0.2;
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.itemStack.typeId !== "pod_farm:watering_can" ||
        placeCooldown$1.has(event.source.id))
        return;
    placeCooldown$1.set(event.source.id, 5);
    handlePlace(event);
    if (event.block.hasTag("pod_farm:crop"))
        system.runTimeout(() => {
            event.cancel = handleWateringCan(event.source, event.block.center(), event.itemStack);
        });
});
function handlePlace(event) {
    if (!event.source.isSneaking ||
        event.blockFace !== Direction.Up ||
        event.block === undefined)
        return;
    system.runTimeout(() => {
        world.playSound("block.lantern.place", event.block.above().center(), {
            pitch: 0.6 + Math.random() * 0.2,
        });
        const can = event.block.dimension.spawnEntity("pod_farm:watering_can_placed", addVector(event.block.above().center(), { y: -0.5 }));
        let rot = event.source.getRotation().y;
        rot += 180;
        rot -= 90;
        if (rot < 0)
            rot = 360 - rot;
        if (rot > 360)
            rot = 0 + (rot - 360);
        rot -= 180;
        can.setRotation({ x: 0, y: rot });
        can.setProperty("pod_farm:fill_level", 5 -
            event.itemStack.getComponent("minecraft:durability").damage);
        event.source.runCommand("replaceitem entity @s slot.weapon.mainhand 0 air");
    });
}
world.afterEvents.dataDrivenEntityTrigger.subscribe((event) => {
    if (event.entity.typeId === "pod_farm:watering_can_placed" &&
        event.eventId === "pod_farm:handlePunch") {
        world.playSound("block.lantern.break", event.entity.location, {
            pitch: 0.6 + Math.random() * 0.2,
        });
        const can = new ItemStack("pod_farm:watering_can");
        can.getComponent("minecraft:durability").damage = 5 - event.entity.getProperty("pod_farm:fill_level");
        event.entity.dimension.spawnItem(can, event.entity.location);
        event.entity.remove();
    }
});
world.afterEvents.itemUse.subscribe((event) => {
    if (event.itemStack.typeId !== "pod_farm:watering_can")
        return;
    if (event.source.isSneaking)
        return;
    const blockMatch = event.source.getBlockFromViewDirection({
        includeLiquidBlocks: true,
        maxDistance: 7,
    });
    if (blockMatch !== undefined &&
        blockMatch.block.permutation.matches("minecraft:water")) {
        world.playSound("bucket.fill_water", blockMatch.block.location);
        blockMatch.block.setPermutation(BlockPermutation.resolve("air"));
        const durability = event.itemStack.getComponent("minecraft:durability");
        durability.damage = 0;
        const equipment = event.source.getComponent(EntityEquippableComponent.componentId);
        if (equipment.getEquipment(EquipmentSlot.Mainhand)?.typeId ===
            "pod_farm:watering_can")
            equipment.setEquipment(EquipmentSlot.Mainhand, event.itemStack);
    }
    else {
        const emittingLocation = forward(event.source.location, event.source.getRotation(), 0.5);
        handleWateringCan(event.source, addVector(emittingLocation, { y: 0.8 }), event.itemStack);
    }
});
function handleWateringCan(player, location, itemStack) {
    const durability = itemStack.getComponent("minecraft:durability");
    if (durability.damage === durability.maxDurability) {
        world.playSound("component.jump_to_block", player.location, {
            pitch: 0.6 + Math.random() * 0.2,
        });
        return false;
    }
    durability.damage++;
    world.playSound("bucket.fill_water", player.location, {
        pitch: 1.2 + Math.random() * 0.4,
    });
    const emittedBlock = player.dimension.getBlock(location);
    if (emittedBlock === undefined)
        return false;
    const blocks = [
        emittedBlock,
        emittedBlock.north(),
        emittedBlock.west(),
        emittedBlock.south(),
        emittedBlock.east(),
    ];
    player.dimension.spawnParticle("pod_farm:water", forward(location, player.getRotation(), 0.5));
    handleAsync(waterPlants(blocks), "watering_can");
    const equipment = player.getComponent(EntityEquippableComponent.componentId);
    if (equipment.getEquipment(EquipmentSlot.Mainhand)?.typeId ===
        "pod_farm:watering_can")
        equipment.setEquipment(EquipmentSlot.Mainhand, itemStack);
    return true;
}
const waterPlants = async (blocks) => {
    for (const block of blocks) {
        if (block.permutation.matches("minecraft:fire")) {
            block.setPermutation(BlockPermutation.resolve("air"));
            continue;
        }
        if (GROWTH_CHANCE >= Math.random())
            handleAsync(waterCropBlock(block), "watering_can");
    }
};
const vanilla_crop_definitions = [
    { block: "minecraft:wheat", maxGrowth: 7 },
    { block: "minecraft:potatoes", maxGrowth: 7 },
    { block: "minecraft:carrots", maxGrowth: 7 },
    { block: "minecraft:beetroot", maxGrowth: 7 },
    { block: "minecraft:sweet_berry_bush", maxGrowth: 3 },
];
const waterCropBlock = async (block) => {
    if (block.hasTag("minecraft:crop")) {
        const cropData = vanilla_crop_definitions.find((v) => v.block === block.typeId);
        if (cropData === undefined ||
            cropData.maxGrowth === block.permutation.getState("growth"))
            return;
        block.dimension.spawnParticle("minecraft:crop_growth_emitter", block.center());
        block.setPermutation(block.permutation.withState("growth", Math.min(cropData.maxGrowth, block.permutation.getState("growth") + 1)));
    }
    if (block.hasTag("pod_farm:crop")) {
        const cropData = cropRegistry[block.typeId];
        if (!cropData)
            return;
        const currentGrowth = block.permutation.getState("pod_farm:growth");
        if (currentGrowth === cropData.maxGrowth)
            return;
        boneMealCrop(block, Math.min(cropData.maxGrowth, currentGrowth + 1));
    }
};

world.afterEvents.itemUse.subscribe((event) => {
    if (event.itemStack.typeId === "pod_farm:quail_egg") {
        const quail_egg = event.source.dimension.spawnEntity("pod_farm:quail_egg", addVector(addVector(event.source.location, { y: 1.6 }), event.source.getViewDirection()));
        world.playSound("random.bow", quail_egg.location, {
            volume: 0.5,
            pitch: 0.33 + Math.random() / 5,
        });
        quail_egg.applyImpulse(changeSpeed(event.source.getViewDirection(), 2));
        if (!event.source.matches({ gameMode: GameMode.creative }))
            event.source.runCommand(`clear @s ${event.itemStack.typeId} 0 1`);
    }
});
system.runInterval(async () => {
    for (const quail_egg of world
        .getDimension("overworld")
        .getEntities({ type: "pod_farm:quail_egg" })) {
        if (Math.abs(quail_egg.getVelocity().x) +
            Math.abs(quail_egg.getVelocity().y) +
            Math.abs(quail_egg.getVelocity().z) <
            0.05) {
            quail_egg.remove();
        }
    }
}, 15);
const changeSpeed = (location, factor) => {
    return {
        x: location.x * factor,
        y: location.y * factor,
        z: location.z * factor,
    };
};

/**
 * Transforms a rotation into the opposite radians rotation
 * @param rotation
 * @returns opposite of rotation
 */
const getOppositeRotationY = (rotation) => {
    rotation = 180 - rotation;
    if (rotation > 180) {
        rotation -= 360;
    }
    else if (rotation < -180) {
        rotation += 360;
    }
    return rotation;
};
/**
 * Converts a direction into the a rotation vector
 * @param direction
 * @returns rotation vector or undefined
 */
function directionToRotation(direction) {
    switch (direction.toUpperCase()) {
        case Direction.Down.toUpperCase():
            return { x: 90, y: 0 };
        case Direction.Up.toUpperCase():
            return { x: -90, y: 0 };
        case Direction.North.toUpperCase():
            return { x: 0, y: 0 };
        case Direction.East.toUpperCase():
            return { x: 0, y: 90 };
        case Direction.South.toUpperCase():
            return { x: 0, y: 180 };
        case Direction.West.toUpperCase():
            return { x: 0, y: -90 };
    }
}

const PAN_RECIPES = RECIPE_REGISTRY.filter((v) => v.cooking_blocks.includes("cooking_pan")).map((v) => {
    return { in: v.ingredients[0].item, out: v.result[0].item };
});
const GRILL_RECIPES = RECIPE_REGISTRY.filter((v) => v.cooking_blocks.includes("grill")).map((v) => {
    return { in: v.ingredients[0].item, out: v.result[0].item };
});
const OVEN_DATA = {
    block: "pod_farm:oven",
    controller: "pod_farm:oven_controller",
    recipes: PAN_RECIPES,
    slots: ["mainhand", "offhand"],
    queueParticles: (entity, block) => {
        const particleAnchor = addVector(block.center(), { y: 0.4 });
        const runId = system.runInterval(() => {
            if (!entity.isValid() ||
                entity.getDynamicProperty("effectId") !== runId) {
                system.clearRun(runId);
                return;
            }
            block.dimension.playSound("block.campfire.crackle", particleAnchor, {
                volume: 0.4 + Math.random() * 0.4,
                pitch: 0.8 + Math.random() * 0.4,
            });
        }, 10);
        entity.setDynamicProperty("effectId", runId);
    },
};
const COOKING_PAN_DATA = {
    //block: "pod_farm:stove_top",
    blockTag: "pod_farm:cooking_pan",
    blockBreakList: [
        { block: "pod_farm:stove_top", states: { "pod_farm:iron_pot": true } },
        { block: "pod_farm:stove_top", states: { "pod_farm:iron_pot": true } },
        { block: "pod_farm:iron_pan", states: {} },
        { block: "pod_farm:copper_pan", states: {} },
    ],
    controller: "pod_farm:cooking_pan_fill",
    recipes: PAN_RECIPES,
    slots: ["mainhand"],
    queueParticles: (entity, block) => {
        const particleAnchor = addVector(block.center(), { y: -0.4 });
        const runId = system.runInterval(() => {
            if (!entity.isValid() ||
                entity.getDynamicProperty("effectId") !== runId) {
                system.clearRun(runId);
                return;
            }
            if (0.35 >= Math.random()) {
                block.dimension.playSound("random.fizz", particleAnchor, {
                    volume: 0.5 + Math.random(),
                    pitch: 2 + Math.random(),
                });
                block.dimension.spawnParticle("minecraft:llama_spit_smoke", addVector(particleAnchor, {
                    x: -0.3 + Math.random() * 0.6,
                    z: -0.3 + Math.random() * 0.6,
                }));
            }
        }, 10);
        entity.setDynamicProperty("effectId", runId);
    },
};
const GRILL_DATA = {
    block: "pod_farm:grill",
    controller: "pod_farm:grill_controller",
    recipes: GRILL_RECIPES,
    slots: ["mainhand", "offhand"],
    fuel: {
        items: [
            {
                id: "minecraft:coal",
                amount: 1,
            },
            {
                id: "minecraft:charcoal",
                amount: 1,
            },
            {
                id: "minecraft:coal_block",
                amount: 9,
            },
        ],
        max: 22,
        igniter: ["minecraft:flint_and_steel"],
    },
    queueParticles: (entity, block) => {
        const particleAnchor = addVector(block.center(), { y: 0.4 });
        const runId = system.runInterval(() => {
            if (!entity.isValid() ||
                entity.getDynamicProperty("effectId") !== runId) {
                system.clearRun(runId);
                return;
            }
            block.dimension.spawnParticle("minecraft:basic_flame_particle", addVector(particleAnchor, {
                x: -0.3 + Math.random() * 0.6,
                z: -0.3 + Math.random() * 0.6,
            }));
            if (0.5 >= Math.random()) {
                block.dimension.spawnParticle("minecraft:campfire_smoke_particle", particleAnchor);
            }
            world.playSound("block.campfire.crackle", particleAnchor, {
                volume: 0.5 + Math.random(),
                pitch: 0.6 + Math.random() * 0.7,
            });
        }, 10);
        entity.setDynamicProperty("effectId", runId);
    },
};
const cookingRegistry = new Map();
const itemUseCooldown$4 = new TimerUtil();
class CookingBlock {
    data;
    constructor(data) {
        this.data = data;
        world.afterEvents.playerBreakBlock.subscribe((event) => {
            this.handleBlockBreak(event);
        });
        world.afterEvents.entityHitBlock.subscribe((event) => {
            if ((this.data.blockTag && !event.hitBlock?.hasTag(this.data.blockTag)) ||
                (!this.data.blockTag &&
                    !event.hitBlock?.permutation.matches(this.data.block, this.data.blockStates)))
                return;
            const { hitBlock } = event;
            const controller = this.getController(hitBlock);
            const slots = this.getSlots(controller);
            let slot = slots.find((v) => v.data.cooked) ||
                slots.find((v) => v.data.item !== "none");
            if (slot === undefined)
                return;
            this.popItem(controller, slot);
            world.playSound("block.itemframe.remove_item", controller.location, {
                pitch: 0.8 + Math.random() * 0.4,
            });
        });
        world.beforeEvents.itemUseOn.subscribe((event) => {
            if ((this.data.blockTag && !event.block.hasTag(this.data.blockTag)) ||
                (!this.data.blockTag &&
                    !event.block.permutation.matches(this.data.block, this.data.blockStates)))
                return;
            if (itemUseCooldown$4.has(event.source.id))
                return;
            const { source, block, itemStack } = event;
            itemUseCooldown$4.set(source.id, 3);
            const fuelSource = this.data.fuel?.items.find((v) => v.id === itemStack.typeId);
            if (fuelSource !== undefined) {
                system.runTimeout(() => {
                    const controller = this.getController(block);
                    const fuelFill = controller.getProperty("pod_farm:fuel");
                    if (fuelFill < 22) {
                        block.setPermutation(block.permutation.withState("pod_farm:fuel", true));
                        controller.setProperty("pod_farm:fuel", Math.min(this.data.fuel?.max, fuelFill + 3 * fuelSource.amount));
                        world.playSound("armor.equip_iron", block.location, {
                            pitch: 0.6 + Math.random() * 0.4,
                        });
                        source.runCommand(`clear @s ${itemStack.typeId} 0 1`);
                    }
                });
            }
            if (this.data.fuel?.igniter.includes(itemStack.typeId)) {
                event.cancel = true;
                system.runTimeout(() => {
                    const controller = this.getController(block);
                    const fuelFill = controller.getProperty("pod_farm:fuel");
                    if (fuelFill !== 0) {
                        controller.setProperty("pod_farm:lit", true);
                        world.playSound("fire.ignite", block.location);
                        block.setPermutation(block.permutation.withState("pod_farm:lit", true));
                        this.updateParticleQueue(block, controller);
                        system.runTimeout(() => {
                            for (const slot of this.getSlots(controller)) {
                                this.startCooking(controller, slot);
                            }
                        }, 1);
                    }
                });
            }
            const food = this.data.recipes.find((v) => v.in === itemStack.typeId);
            if (food !== undefined) {
                system.runTimeout(() => {
                    this.addItem(source, block, itemStack);
                    const controller = this.getController(block);
                    this.updateParticleQueue(block, controller);
                });
            }
        });
        world.afterEvents.dataDrivenEntityTrigger.subscribe((event) => {
            if (!event.entity.isValid() ||
                !event.entity.matches({ type: this.data.controller }))
                return;
            const { eventId, entity } = event;
            if (eventId === "pod_farm:update") {
                const block = this.getBlock(entity);
                if (block === undefined) {
                    this.removeController(entity);
                    return;
                }
                this.updateParticleQueue(block, entity);
                if (this.data.fuel !== undefined)
                    this.updateFuelFill(entity, block);
                //Required for certain situations (e.g. world reload);
                let filledSlot = false;
                for (const slot of this.getSlots(entity)) {
                    if (!filledSlot)
                        filledSlot = slot.data.item !== "none";
                    this.startCooking(entity, slot);
                }
                if (entity.hasTag("pod_farm.Immune")) {
                    entity.removeTag("pod_farm.Immune");
                }
                else if (!filledSlot &&
                    (entity.getProperty("pod_farm:fuel") || 0) === 0) {
                    this.removeController(entity);
                }
            }
        });
    }
    handleBlockBreak(event) {
        if ((this.data.blockBreakList &&
            permutationMatches(event.brokenBlockPermutation, this.data.blockBreakList)) ||
            (!this.data.blockBreakList &&
                event.brokenBlockPermutation.matches(this.data.block, this.data.blockStates))) {
            for (const controller of event.block.dimension
                .getEntitiesAtBlockLocation(event.block.center())
                .filter((v) => v.typeId === this.data.controller)) {
                this.removeController(controller);
            }
        }
    }
    addItem(source, block, itemStack) {
        const controller = this.getController(block);
        const slots = this.getSlots(controller);
        let slot = slots.find((v) => v.data.item === "none") ||
            slots.find((v) => v.data.cooked) ||
            slots.find((v) => v.id !== (controller.getDynamicProperty("lastUpdated") || "mainhand")) ||
            slots[0];
        if (slot.data.item !== "none")
            this.popItem(controller, slot);
        slot = this.swapItem(controller, slot, {
            item: itemStack.typeId,
            cooked: false,
        });
        world.playSound("block.itemframe.add_item", block.location, {
            pitch: 0.8 + Math.random() * 0.4,
        });
        this.startCooking(controller, slot, true);
        source.runCommand(`clear @s ${itemStack.typeId} 0 1`);
    }
    /**
     *
     * @param {Block} block
     */
    getController(block) {
        const controllerMatches = block.dimension
            .getEntitiesAtBlockLocation(block.center())
            .filter((v) => v.typeId === this.data.controller);
        if (controllerMatches.length === 0) {
            //Using the command here instead of the spawnEntity function because when trying to set the rotation after spawning the entity with the function, it will take a few seconds to rotate
            block.dimension.runCommand(`summon ${this.data.controller} ${block.center().x} ${block.center().y} ${block.center().z} ${directionToRotation(block.permutation.getState("minecraft:cardinal_direction")).y} ~ ${block.hasTag("pod_farm:no_cook")
                ? "pod_farm:no_cook"
                : "minecraft:entity_spawned"}`);
            const controller = this.getController(block);
            controller.addTag("pod_farm.Immune");
            controller.triggerEvent("pod_farm:update");
            return controller;
        }
        else if (controllerMatches.length === 1) {
            return controllerMatches[0];
        }
        else {
            for (let i = 1; i < controllerMatches.length; i++) {
                this.removeController(controllerMatches[i]);
            }
            return controllerMatches[0];
        }
    }
    /**
     *
     * @param {Entity} entity
     */
    removeController(entity) {
        if (!entity.isValid())
            return;
        try {
            this.cancelCooking(entity);
            this.popItem(entity, this.getSlotData(entity, "mainhand"));
            this.popItem(entity, this.getSlotData(entity, "offhand"));
            if (this.data.fuel !== undefined) {
                const fuelCount = Math.floor(entity.getProperty("pod_farm:fuel") / 3);
                if (fuelCount !== 0)
                    entity.dimension.spawnItem(new ItemStack("minecraft:coal", fuelCount), entity.location);
            }
        }
        catch (e) {
            log(e);
        }
        entity.remove();
    }
    /**
     *
     * @param {Entity} entity
     */
    getBlock(entity) {
        const block = entity.dimension.getBlock(entity.location);
        if ((this.data.blockTag && block?.hasTag(this.data.blockTag)) ||
            (!this.data.blockTag &&
                block?.permutation.matches(this.data.block, this.data.blockStates)))
            return block;
        this.removeController(entity);
        return undefined;
    }
    updateParticleQueue(block, entity = this.getController(block)) {
        if (this.data.queueParticles === undefined)
            return;
        if (this.data.fuel !== undefined && entity.getProperty("pod_farm:lit")) {
            this.data.queueParticles(entity, block);
        }
        else if (this.data.fuel === undefined) {
            let queueParticles = false;
            for (const slot of this.getSlots(entity)) {
                if (!queueParticles)
                    queueParticles = slot.data.item !== "none" && !slot.data.cooked;
            }
            if (queueParticles && !entity.getProperty("pod_farm:no_cook")) {
                this.data.queueParticles(entity, block);
            }
            else {
                entity.setDynamicProperty("effectId");
            }
        }
    }
    /**
     *
     * @param {Entity} entity
     * @param {Block} block
     */
    updateFuelFill(entity, block) {
        if (!entity.getProperty("pod_farm:lit"))
            return;
        const fuelFill = entity.getProperty("pod_farm:fuel");
        if (fuelFill < 1)
            return;
        if (fuelFill === 1) {
            entity.setDynamicProperty("effectId");
            entity.setProperty("pod_farm:lit", false);
            this.cancelCooking(entity);
            block.setPermutation(block.permutation
                .withState("pod_farm:fuel", false)
                .withState("pod_farm:lit", false));
        }
        entity.setProperty("pod_farm:fuel", Math.max(fuelFill - 1, 0));
    }
    popItem(entity, slot) {
        if (slot.data.item === "none")
            return;
        entity.dimension.spawnItem(new ItemStack(slot.data.item), 
        //TODO: Possibly allow data driven drop location
        addVector(entity.location, { y: 0.5 }));
        this.swapItem(entity, slot, { item: "none", cooked: false });
        const runId = cookingRegistry.get(entity.id + "_" + slot.id);
        if (runId !== undefined)
            system.clearRun(runId);
    }
    swapItem(entity, slot, data) {
        entity.setDynamicProperty(slot.id, JSON.stringify(data));
        entity.runCommand(`replaceitem entity @s slot.weapon.${slot.id} 0 ${data.item === "none" ? "air" : data.item}`);
        entity.setDynamicProperty("lastUpdated", slot.id);
        return { id: slot.id, data: data };
    }
    getSlots(entity) {
        return this.data.slots.map((v) => this.getSlotData(entity, v));
    }
    getSlotData(entity, slot) {
        const dataString = entity.getDynamicProperty(slot) || `{"item": "none", "cooked": false}`;
        return {
            id: slot,
            data: JSON.parse(dataString),
        };
    }
    cancelCooking(entity) {
        for (const id of [
            cookingRegistry.get(entity.id + "_mainhand"),
            cookingRegistry.get(entity.id + "_offhand"),
        ]) {
            if (id !== undefined)
                system.clearRun(id);
        }
    }
    startCooking(entity, slot, replaceOld = false) {
        if (this.data.fuel !== undefined && !entity.getProperty("pod_farm:lit"))
            return;
        if (entity.getProperty("pod_farm:no_cook"))
            return;
        if (slot.data.item === "none" ||
            slot.data.cooked ||
            (!replaceOld && cookingRegistry.has(entity.id + "_" + slot.id)))
            return;
        const current = cookingRegistry.get(entity.id + "_" + slot.id);
        if (current !== undefined)
            system.clearRun(current);
        const runId = system.runTimeout(() => {
            this.swapItem(entity, slot, {
                item: this.data.recipes.find((v) => v.in === slot.data.item).out,
                cooked: true,
            });
            cookingRegistry.delete(entity.id + "_" + slot.id);
            this.updateParticleQueue(this.getBlock(entity), entity);
            //TODO: Possibly spawn exp orb
        }, (8 + Math.random() * 4) * 20);
        cookingRegistry.set(entity.id + "_" + slot.id, runId);
    }
}
const GRILL_COOKING_BLOCK = new CookingBlock(GRILL_DATA);
const PAN_COOKING_BLOCK = new CookingBlock(COOKING_PAN_DATA);
new CookingBlock(OVEN_DATA);

const replaceables = [
    "tallgrass",
    "nether_sprouts",
    "vine",
    "glow_lichen"
];

const tin_cans = {
    id: "pod_farm:tin_can_block",
    max_stack: 3,
    placeSound: {
        sound: "block.lantern.place",
        soundOptions: {
            pitch: 0.8 + Math.random() * 0.2,
        },
    },
    breakSound: {
        sound: "block.lantern.break",
        soundOptions: {
            pitch: 0.8 + Math.random() * 0.2,
        },
    },
    elements: [
        {
            item: "pod_farm:tin_can",
            type: "empty",
        },
        {
            item: "pod_farm:tinned_beans",
            type: "beans",
        },
        {
            item: "pod_farm:tinned_corn",
            type: "corn",
        },
        {
            item: "pod_farm:tinned_cranberries",
            type: "cranberries",
        },
        {
            item: "pod_farm:tinned_lemons",
            type: "lemons",
        },
        {
            item: "pod_farm:tinned_peaches",
            type: "peaches",
        },
        {
            item: "pod_farm:tinned_pears",
            type: "pears",
        },
        {
            item: "pod_farm:tinned_peas",
            type: "peas",
        },
        {
            item: "pod_farm:tinned_pineapples",
            type: "pineapples",
        },
        {
            item: "pod_farm:tinned_raspberries",
            type: "raspberries",
        },
        {
            item: "pod_farm:tinned_tomatoes",
            type: "tomatoes",
        },
    ],
};
const jars = {
    id: "pod_farm:jar",
    max_stack: 1,
    placeSound: {
        sound: "break.decorated_pot",
        soundOptions: {},
    },
    breakSound: {
        sound: "block.decorated_pot.insert",
        soundOptions: {
            pitch: 0.8 + Math.random() * 0.4,
        },
    },
    elements: [
        {
            item: "pod_farm:blackberry_jam",
            type: "blackberry",
        },
        {
            item: "pod_farm:blueberry_jam",
            type: "blueberry",
        },
        {
            item: "pod_farm:chili_jam",
            type: "chili",
        },
        {
            item: "pod_farm:grape_jam",
            type: "grape",
        },
        {
            item: "pod_farm:marmalade",
            type: "marmalade",
        },
        {
            item: "pod_farm:peach_jam",
            type: "peach",
        },
        {
            item: "pod_farm:raspberry_jam",
            type: "raspberry",
        },
        {
            item: "pod_farm:strawberry_jam",
            type: "strawberry",
        },
        {
            item: "pod_farm:peanut_butter",
            type: "peanut_butter",
        },
    ],
};
function registerStackableBlock(data) {
    world.beforeEvents.itemUseOn.subscribe((event) => onItemUseOn(event, data));
    world.afterEvents.entityHitBlock.subscribe((event) => onEntityHitBlock(event, data));
    world.beforeEvents.playerBreakBlock.subscribe((event) => onPlayerBreakBlock(event, data));
}
world.afterEvents.playerPlaceBlock.subscribe((event) => {
    if (event.block.hasTag("pod_farm:stackable_block") &&
        event.block.permutation.getState("pod_farm:type") === "invisible") {
        event.block.setPermutation(BlockPermutation.resolve("air"));
    }
});
registerStackableBlock(tin_cans);
registerStackableBlock(jars);
const placeCooldown = new TimerUtil();
function onEntityHitBlock(event, data) {
    if (event.hitBlock.permutation.matches(data.id) &&
        !event.damagingEntity.matches({ gameMode: GameMode.creative }))
        handlePunch(event.hitBlock, data);
}
function onPlayerBreakBlock(event, data) {
    if (event.block.permutation.matches(data.id)) {
        event.cancel = true;
        system.runTimeout(() => {
            handlePunch(event.block, data);
        });
    }
}
function handlePunch(block, data) {
    const typeResult = data.elements.find((v) => v.type === block.permutation.getState("pod_farm:type"));
    if (typeResult === undefined) {
        block.setPermutation(BlockPermutation.resolve("air"));
        return;
    }
    const count = block.permutation.getState("pod_farm:count");
    block.dimension.spawnItem(new ItemStack(typeResult.item), block.location);
    world.playSound(data.breakSound.sound, block.location, data.breakSound.soundOptions);
    if (count === 0)
        block.setPermutation(BlockPermutation.resolve("air"));
    else
        block.setPermutation(block.permutation.withState("pod_farm:count", count - 1));
}
const COOKING_BLOCKS = ["pod_farm:blender"];
function onItemUseOn(event, data) {
    if (placeCooldown.has(event.source.id) ||
        !event.itemStack.hasTag(data.id) ||
        interactables.includes(event.block.typeId) ||
        COOKING_BLOCKS.includes(event.block.typeId))
        return;
    const { block, itemStack, source, blockFace } = event;
    let replacedBlock = undefined;
    const typeResult = data.elements.find((v) => v.item === itemStack.typeId);
    if (typeResult === undefined)
        return;
    placeCooldown.set(source.id, 6);
    if (!source.isSneaking &&
        block.permutation.matches(data.id, {
            "pod_farm:type": typeResult.type,
        })) {
        const count = block.permutation.getState("pod_farm:count");
        if (count === data.max_stack)
            return;
        system.runTimeout(() => {
            block.setPermutation(block.permutation.withState("pod_farm:count", count + 1));
            world.playSound(data.placeSound.sound, block.location, data.placeSound.soundOptions);
            if (source.matches({ gameMode: GameMode.creative }))
                return;
            source.runCommand(`clear @s ${itemStack.typeId} 0 1`);
        });
        return;
    }
    switch (blockFace) {
        case Direction.Down:
            replacedBlock = block.below(2);
            break;
        case Direction.North:
            replacedBlock = block.north();
            break;
        case Direction.East:
            replacedBlock = block.east();
            break;
        case Direction.South:
            replacedBlock = block.south();
            break;
        case Direction.West:
            replacedBlock = block.west();
            break;
        case Direction.Up:
            replacedBlock = block.above();
            break;
    }
    if (replacedBlock !== undefined &&
        (replacedBlock.isAir ||
            replacedBlock.isLiquid ||
            replaceables.includes(replacedBlock.typeId))) {
        if (source.dimension.getEntitiesAtBlockLocation(replacedBlock.location)
            .length !== 0)
            return;
        let direction = Direction.South;
        switch (Math.round((getOppositeRotationY(source.getRotation().y) + 180) / 90)) {
            case 1:
                direction = Direction.East;
                break;
            case 2:
                direction = Direction.North;
                break;
            case 3:
                direction = Direction.West;
                break;
        }
        system.runTimeout(() => {
            replacedBlock.setPermutation(BlockPermutation.resolve(data.id, {
                "pod_farm:type": typeResult.type,
                "pod_farm:count": 0,
                "minecraft:cardinal_direction": direction.toLowerCase(),
            }));
            world.playSound(data.placeSound.sound, replacedBlock.location, data.placeSound.soundOptions);
            if (source.matches({ gameMode: GameMode.creative }))
                return;
            source.runCommand(`clear @s ${itemStack.typeId} 0 1`);
        });
    }
}

const juices = [
    {
        id: "apple",
        item: "pod_farm:apple_juice",
        fill_item: "minecraft:apple",
    },
    {
        id: "blackberry",
        item: "pod_farm:blackberry_juice",
        fill_item: "pod_farm:blackberry",
    },
    {
        id: "blueberry",
        item: "pod_farm:blueberry_juice",
        fill_item: "pod_farm:blueberry",
    },
    {
        id: "cranberry",
        item: "pod_farm:cranberry_juice",
        fill_item: "pod_farm:cranberry",
    },
    {
        id: "grape",
        item: "pod_farm:grape_juice",
        fill_item: "pod_farm:grape",
    },
    {
        id: "orange",
        item: "pod_farm:orange_juice",
        fill_item: "pod_farm:orange",
    },
    {
        id: "pear",
        item: "pod_farm:pear_juice",
        fill_item: "pod_farm:pear",
    },
    {
        id: "pineapple",
        item: "pod_farm:pineapple_juice",
        fill_item: "pod_farm:pineapple",
    },
    {
        id: "raspberry",
        item: "pod_farm:raspberry_juice",
        fill_item: "pod_farm:raspberry",
    },
    {
        id: "strawberry",
        item: "pod_farm:strawberry_juice",
        fill_item: "pod_farm:strawberry",
    },
    {
        id: "tomato",
        item: "pod_farm:tomato_juice",
        fill_item: "pod_farm:tomato",
    },
    {
        id: "carrot",
        item: "pod_farm:carrot_juice",
        fill_item: "minecraft:carrot",
    },
    {
        id: "golden_apple",
        item: "pod_farm:golden_apple_juice",
        fill_item: "minecraft:golden_apple",
    },
    {
        id: "lemon",
        item: "pod_farm:lemonade",
        fill_item: "pod_farm:lemon",
    },
];
const cooldowns = new TimerUtil();
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.permutation.matches("pod_farm:juicer")) {
        if (cooldowns.has(event.source.id))
            return;
        cooldowns.set(event.source.id, 3);
        if (event.itemStack.typeId === "minecraft:glass_bottle" &&
            event.block.permutation.getState("pod_farm:fill_level") >= 2) {
            event.cancel = true;
            system.runTimeout(() => {
                event.block.setPermutation(event.block.permutation.withState("pod_farm:fill_level", event.block.permutation.getState("pod_farm:fill_level") - 2));
                event.source.runCommand("clear @s minecraft:glass_bottle 0 1");
                world.playSound("mob.mooshroom.suspicious_milk", event.block.location);
                const juice = juices.find((v) => v.id === event.block.permutation.getState("pod_farm:fruit_type"));
                const container = event.source.getComponent(EntityInventoryComponent.componentId).container;
                if (!juice || !container)
                    return;
                const itemStack = new ItemStack(juice.item, 1);
                if (container.emptySlotsCount === 0) {
                    event.source.dimension.spawnItem(itemStack, event.source.location);
                }
                else {
                    container.addItem(itemStack);
                }
            });
        }
        else {
            const foundJuice = juices.find((v) => v.fill_item === event.itemStack.typeId);
            if (foundJuice) {
                event.cancel = true;
                system.runTimeout(() => {
                    if (event.block.permutation.getState("pod_farm:fill_level") === 0) {
                        event.source.runCommand(`clear @s ${foundJuice.fill_item} 0 1`);
                        world.playSound("mob.mooshroom.suspicious_milk", event.block.location, {
                            pitch: 1.4 + Math.random() * 0.2,
                            volume: 2,
                        });
                        event.block.setPermutation(BlockPermutation.resolve("pod_farm:juicer", {
                            "pod_farm:fill_level": 1,
                            "pod_farm:fruit_type": foundJuice.id,
                            "minecraft:cardinal_direction": event.block.permutation.getState("minecraft:cardinal_direction"),
                        }));
                    }
                    else {
                        if (event.block.permutation.getState("pod_farm:fruit_type") ===
                            foundJuice.id &&
                            event.block.permutation.getState("pod_farm:fill_level") !== 10) {
                            event.source.runCommand(`clear @s ${foundJuice.fill_item} 0 1`);
                            world.playSound("mob.mooshroom.suspicious_milk", event.block.location, {
                                pitch: 1.4 + Math.random() * 0.2,
                                volume: 2,
                            });
                            event.block.setPermutation(event.block.permutation.withState("pod_farm:fill_level", event.block.permutation.getState("pod_farm:fill_level") + 1));
                        }
                    }
                });
            }
        }
    }
});

world.afterEvents.entitySpawn.subscribe((event) => {
    if (event.entity.typeId === "pod_farm:fridge") {
        const { entity } = event;
        const block = entity.dimension.getBlock(entity.location);
        const matchBelow = entity.dimension
            .getEntitiesAtBlockLocation(block.below())
            .find((v) => v.typeId === "pod_farm:fridge");
        if (matchBelow !== undefined &&
            matchBelow.getProperty("pod_farm:connect") === "single" &&
            matchBelow.getRotation().y === entity.getRotation().y) {
            matchBelow.setProperty("pod_farm:connect", "up");
            entity.setProperty("pod_farm:connect", "down");
        }
        else {
            const matchAbove = entity.dimension
                .getEntitiesAtBlockLocation(block.above())
                .find((v) => v.typeId === "pod_farm:fridge");
            if (matchAbove !== undefined &&
                matchAbove.getProperty("pod_farm:connect") === "single" &&
                matchAbove.getRotation().y === entity.getRotation().y) {
                matchAbove.setProperty("pod_farm:connect", "down");
                entity.setProperty("pod_farm:connect", "up");
            }
        }
    }
});
world.afterEvents.playerPlaceBlock.subscribe((event) => {
    if (event.block.permutation.matches("pod_farm:fridge_item")) {
        event.dimension.runCommand(`summon pod_farm:fridge ${event.block.center().x} ${event.block.y} ${event.block.center().z} ${directionToRotation(event.block.permutation.getState("minecraft:cardinal_direction")).y} ~ minecraft:entity_spawned "§r"`);
        event.block.setPermutation(BlockPermutation.resolve("pod_farm:collision_block"));
    }
});
world.afterEvents.entityHitEntity.subscribe((event) => {
    if (event.hitEntity.typeId === "pod_farm:fridge") {
        const { hitEntity } = event;
        const block = hitEntity.dimension.getBlock(hitEntity.location);
        const container = hitEntity.getComponent(EntityInventoryComponent.componentId)?.container;
        const connectedFridge = getConnectedFridge(hitEntity);
        if (connectedFridge !== undefined)
            connectedFridge.setProperty("pod_farm:connect", "single");
        for (let i = 0; i < container.size; i++) {
            if (container.getItem(i) !== undefined)
                hitEntity.dimension.spawnItem(container.getItem(i), hitEntity.location);
        }
        hitEntity.dimension.spawnItem(new ItemStack("pod_farm:fridge_item"), hitEntity.location);
        hitEntity.remove();
        block?.setPermutation(BlockPermutation.resolve("air"));
    }
});
world.afterEvents.dataDrivenEntityTrigger.subscribe((event) => {
    if (event.entity.typeId === "pod_farm:fridge") {
        if (["pod_farm:open", "pod_farm:close"].includes(event.eventId)) {
            const connectedFridge = getConnectedFridge(event.entity);
            const state = event.eventId === "pod_farm:open";
            const lookedAt = isLookedAt(event.entity);
            if (!state || lookedAt) {
                event.entity.setProperty("pod_farm:open", state);
                if (connectedFridge !== undefined)
                    connectedFridge.setProperty("pod_farm:open", state);
                //Only play sound if the entity is actually looked at to avoid double sound on closing
                if (lookedAt) {
                    world.playSound(state ? "open.iron_door" : "close.iron_door", event.entity.location, {
                        pitch: 0.8 + Math.random() * 0.4,
                    });
                }
            }
        }
    }
});
function isLookedAt(entity) {
    for (const player of entity.dimension.getPlayers({
        location: entity.location,
        maxDistance: 8,
    })) {
        const block = player.getBlockFromViewDirection({ maxDistance: 6 });
        if (block?.block?.permutation?.matches("pod_farm:collision_block")) {
            if (player.dimension
                .getEntitiesAtBlockLocation(block.block)
                .some((v) => v.id === entity.id))
                return true;
        }
    }
    return false;
}
function getConnectedFridge(entity) {
    const block = entity.dimension.getBlock(entity.location);
    switch (entity.getProperty("pod_farm:connect")) {
        case "up":
            return entity.dimension
                .getEntitiesAtBlockLocation(block.above())
                .find((v) => v.typeId === "pod_farm:fridge");
        case "down":
            return entity.dimension
                .getEntitiesAtBlockLocation(block.below())
                .find((v) => v.typeId === "pod_farm:fridge");
    }
}

const BLENDER_CONTAINERS = [
    "minecraft:glass_bottle",
    "pod_farm:ice_cream_cone",
    "minecraft:bowl",
];
const BLENDER_ITEM_WHITELIST = [
    "minecraft:snowball",
    "minecraft:sugar",
    "minecraft:milk_bucket",
    "minecraft:potion",
    "minecraft:honey_bottle",
    "minecraft:cocoa_beans",
    "pod_farm:tomato_sauce",
    "pod_farm:vanilla",
    "pod_farm:tea",
    "pod_farm:pea_seeds",
    "pod_farm:coffee_plant_seeds",
    "pod_farm:coffee",
    "pod_farm:pasta",
];
const CUSTOMIZEABLE_SMOOTHIE_RECIPES = [
    {
        required: ["pod_farm:spinach"],
        optional: [
            "pod_farm:avocado",
            "pod_farm:banana",
            "pod_farm:pineapple",
            "pod_farm:cracked_coconut",
            "pod_farm:lemon",
        ],
        minimumRequiredOptionals: 1,
        result: "pod_farm:tropical_green_smoothie",
    },
    {
        required: ["minecraft:beetroot"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_beet_smoothie",
    },
    {
        required: ["minecraft:carrot", "pod_farm:ginger"],
        optional: ["pod_farm:orange", "pod_farm:lemon", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:carrot_ginger_smoothie",
    },
    {
        required: ["pod_farm:avocado", "pod_farm:peach"],
        optional: ["pod_farm:spinach", "pod_farm:banana", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:avocado_peach_smoothie",
    },
    {
        required: ["pod_farm:pineapple", "pod_farm:cracked_coconut"],
        optional: ["pod_farm:banana", "pod_farm:spinach", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:pineapple_coconut_smoothie",
    },
    {
        required: ["pod_farm:banana"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_banana_smoothie",
    },
    {
        required: ["pod_farm:spinach", "pod_farm:cucumber", "pod_farm:ginger"],
        optional: ["minecraft:apple", "pod_farm:lemon", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:green_detox_smoothie",
    },
    {
        required: ["pod_farm:peanut_butter", "pod_farm:banana"],
        optional: ["minecraft:cocoa_beans", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:peanut_butter_banana_smoothie",
    },
    {
        required: ["minecraft:carrot"],
        optional: [
            "pod_farm:orange",
            "pod_farm:banana",
            "pod_farm:pineapple",
            "pod_farm:cracked_coconut",
            "pod_farm:lemon",
        ],
        minimumRequiredOptionals: 1,
        result: "pod_farm:tropical_carrot_smoothie",
    },
    {
        required: ["pod_farm:orange", "pod_farm:lemon"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_citrus_smoothie",
    },
    {
        required: ["pod_farm:blueberry", "pod_farm:ginger"],
        optional: ["pod_farm:banana", "pod_farm:spinach", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:blueberry_ginger_smoothie",
    },
    {
        required: ["pod_farm:peach", "pod_farm:spinach"],
        optional: ["pod_farm:banana", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:peachy_green_smoothie",
    },
    {
        required: ["pod_farm:banana", "minecraft:apple"],
        optional: ["pod_farm:pear", "minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:apple_banana_smoothie",
    },
    {
        required: [],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_smoothie",
    },
    {
        required: [],
        optional: [
            "pod_farm:avocado",
            "pod_farm:orange",
            "pod_farm:banana",
            "pod_farm:pineapple",
            "pod_farm:cracked_coconut",
            "pod_farm:lemon",
        ],
        minimumRequiredOptionals: 1,
        result: "pod_farm:tropical_smoothie",
    },
    {
        required: [],
        optional: [...getTaggedItems("healthy")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:healthy_smoothie",
    },
];
const CUSTOMIZEABLE_MILKSHAKE_RECIPES = [
    {
        required: ["pod_farm:banana"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_banana_milkshake",
    },
    {
        required: ["pod_farm:cracked_coconut"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_coconut_milkshake",
    },
    {
        required: ["pod_farm:vanilla"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:vanilla_berry_milkshake",
    },
    {
        required: ["pod_farm:ginger"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_ginger_milkshake",
    },
    {
        required: ["pod_farm:rhubarb"],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_rhubarb_milkshake",
    },
    {
        required: ["pod_farm:peach", "minecraft:honey_bottle"],
        optional: ["pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:peach_honey_milkshake",
    },
    {
        required: ["pod_farm:banana", "pod_farm:peanut_butter"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:peanut_butter_banana_milkshake",
    },
    {
        required: ["pod_farm:pineapple", "pod_farm:cracked_coconut"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:pineapple_coconut_milkshake",
    },
    {
        required: ["pod_farm:coffee", "pod_farm:banana"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:coffee_banana_milkshake",
    },
    {
        required: ["pod_farm:coffee", "pod_farm:vanilla"],
        optional: ["minecraft:honey_bottle"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:coffee_vanilla_milkshake",
    },
    {
        required: ["pod_farm:peach", "minecraft:melon_slice"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:peach_melon_milkshake",
    },
    {
        required: ["pod_farm:banana", "minecraft:cocoa_beans"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:chocolate_banana_milkshake",
    },
    {
        required: ["pod_farm:orange", "pod_farm:lemon"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:citrus_milkshake",
    },
    {
        required: ["pod_farm:peach", "pod_farm:ginger"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:ginger_peach_milkshake",
    },
    {
        required: ["pod_farm:pineapple", "pod_farm:ginger"],
        optional: ["minecraft:honey_bottle", "pod_farm:vanilla"],
        minimumRequiredOptionals: 0,
        result: "pod_farm:pineapple_ginger_milkshake",
    },
    {
        required: ["pod_farm:peanut", "minecraft:cocoa_beans"],
        optional: [],
        minimumRequiredOptionals: 0,
        result: "pod_farm:chocolate_peanut_milkshake",
    },
    {
        required: ["minecraft:cookie", "minecraft:cocoa_beans"],
        optional: [],
        minimumRequiredOptionals: 0,
        result: "pod_farm:chocolate_cookie_milkshake",
    },
    {
        required: ["minecraft:cocoa_beans"],
        optional: [],
        minimumRequiredOptionals: 0,
        result: "pod_farm:chocolate_milkshake",
    },
    {
        required: ["pod_farm:vanilla"],
        optional: [],
        minimumRequiredOptionals: 0,
        result: "pod_farm:vanilla_milkshake",
    },
    {
        required: [],
        optional: [...getTaggedItems("berry")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:berry_milkshake",
    },
    {
        required: [],
        optional: [
            "pod_farm:avocado",
            "pod_farm:orange",
            "pod_farm:banana",
            "pod_farm:pineapple",
            "pod_farm:cracked_coconut",
            "pod_farm:lemon",
        ],
        minimumRequiredOptionals: 1,
        result: "pod_farm:tropical_milkshake",
    },
    {
        required: [],
        optional: [...getTaggedItems("healthy")],
        minimumRequiredOptionals: 1,
        result: "pod_farm:healthy_milkshake",
    },
];

class JsonProperties {
    entity;
    constructor(entity) {
        this.entity = entity;
    }
    read(key) {
        if (this.entity === undefined)
            return undefined;
        const data = this.entity.getDynamicProperty(key);
        if (data === undefined || !isString(data))
            return undefined;
        return JSON.parse(data);
    }
    readOrDefault(key, defaultValue) {
        const data = this.read(key);
        if (data === undefined)
            return defaultValue;
        return data;
    }
    write(key, data) {
        this.entity.setDynamicProperty(key, JSON.stringify(data));
    }
}

const itemUseCooldown$3 = new TimerUtil();
const blendDelay = new TimerUtil();
const CANCEL_ITEM_USE = [
    "minecraft:snowball",
    "minecraft:egg",
    "pod_farm:quail_egg",
];
world.beforeEvents.itemUse.subscribe((event) => {
    if (CANCEL_ITEM_USE.includes(event.itemStack.typeId) &&
        event.source
            .getBlockFromViewDirection({ maxDistance: 5 })
            ?.block?.hasTag("pod_farm:cancel_item_use")) {
        event.cancel = true;
    }
});
const BLENDER_RECIPES = RECIPE_REGISTRY.filter((v) => v.cooking_blocks.includes("blender"));
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.permutation.matches("pod_farm:blender") &&
        !itemUseCooldown$3.has(event.source.id)) {
        const { block, itemStack, source } = event;
        itemUseCooldown$3.set(source.id, 3);
        if (BLENDER_CONTAINERS.includes(itemStack.typeId)) {
            system.runTimeout(() => {
                const fillEntity = getFillEntity$1(block, false);
                if (fillEntity === undefined)
                    return;
                const entityProperties = new JsonProperties(fillEntity);
                const items = entityProperties.readOrDefault("items", []);
                if (items.length === 0) {
                    return;
                }
                if (blendDelay.has(fillEntity.id))
                    return;
                if (items.length === 1) {
                    const definition = ITEM_DEFINITIONS[items[0]];
                    if (definition !== undefined &&
                        definition.convertsTo !== undefined &&
                        (definition.convertsTo === itemStack.typeId ||
                            definition.convertsTo === itemStack.typeId.split(":")[1])) {
                        blend(source, itemStack, fillEntity, items[0]);
                        return;
                    }
                }
                if (itemStack.typeId === "minecraft:bowl")
                    return;
                const recipeMatch = BLENDER_RECIPES.filter((v) => v.data?.optional === undefined)
                    .filter((v) => v.ingredients.length === items.length)
                    .find((v) => compareArrays(v.ingredients.flatMap((v) => Array(v.amount || 1).fill(v.item)), items));
                if (recipeMatch === undefined) {
                    if (items.includes("minecraft:snowball") &&
                        itemStack.typeId !== "pod_farm:ice_cream_cone") {
                        displayWarning(source, `blender.use_hint.pod_farm:ice_cream_cone`);
                        return;
                    }
                    else if (!items.includes("minecraft:snowball") &&
                        itemStack.typeId === "pod_farm:ice_cream_cone") {
                        displayWarning(source, `blender.use_hint.minecraft:glass_bottle`);
                        return;
                    }
                    const itemResult = getSituationalRecipeResult(items);
                    if (itemResult === undefined)
                        return;
                    blend(source, itemStack, fillEntity, itemResult);
                    return;
                }
                else {
                    if (recipeMatch.data.container !== itemStack.typeId) {
                        displayWarning(source, `blender.use_hint.${recipeMatch.data.container}`);
                        return;
                    }
                    blend(source, itemStack, fillEntity, recipeMatch.result[0].item);
                }
            });
        }
        else if (itemStack.hasTag("minecraft:is_food") ||
            BLENDER_ITEM_WHITELIST.includes(itemStack.typeId)) {
            event.cancel = true;
            system.runTimeout(() => {
                const fillEntity = getFillEntity$1(block, true);
                const entityProperties = new JsonProperties(fillEntity);
                const items = entityProperties.readOrDefault("items", []);
                if (items.length === 9) {
                    displayWarning(source, "blender.full");
                    return;
                }
                items.push(itemStack.typeId);
                const colors = items.map((v) => ITEM_DEFINITIONS[v]?.color || { r: 245, g: 221, b: 181 });
                let r = 0, g = 0, b = 0;
                for (const color of colors) {
                    r += color.r;
                    g += color.g;
                    b += color.b;
                }
                consumeItem(source, itemStack.typeId, 1);
                const convertsTo = ITEM_DEFINITIONS[itemStack.typeId]?.convertsTo;
                if (convertsTo !== undefined)
                    source.dimension.spawnItem(new ItemStack(convertsTo), source.location);
                entityProperties.write("items", items);
                fillEntity.setProperty("pod_farm:red", Math.round(r / items.length));
                fillEntity.setProperty("pod_farm:green", Math.round(g / items.length));
                fillEntity.setProperty("pod_farm:blue", Math.round(b / items.length));
                blendDelay.set(fillEntity.id, 25);
                system.runTimeout(() => fillEntity.playAnimation("animation.pod_farm.blender_fill.blend"), 3);
                block.dimension.playSound("pod_farm.blender.blend", block.center(), {
                    pitch: 0.8 + Math.random() * 0.4,
                    volume: 0.2,
                });
            });
        }
    }
});
world.afterEvents.playerBreakBlock.subscribe((event) => {
    if (event.brokenBlockPermutation.matches("pod_farm:blender")) {
        for (const entity of event.block.dimension
            .getEntitiesAtBlockLocation(event.block)
            .filter((v) => v.typeId === "pod_farm:blender_fill")) {
            entity.remove();
        }
    }
});
function blend(source, itemStack, fillEntity, result) {
    fillEntity.dimension.playSound("bucket.fill_powder_snow", fillEntity.location, { pitch: 1.2 });
    removeFillEntity$1(fillEntity);
    if (result === undefined)
        return;
    consumeItem(source, itemStack.typeId);
    source.dimension.spawnItem(new ItemStack(result), source.location);
}
function getSituationalRecipeResult(items) {
    if (items.includes("minecraft:snowball")) {
        const ingredientDefinitions = items
            .filter((v) => v !== "minecraft:sugar" && v !== "minecraft:snowball")
            .map((v) => ITEM_DEFINITIONS[v] || { tags: [] });
        if (ingredientDefinitions.length === 0)
            return;
        if (items.filter((v) => v === "minecraft:sugar").length >= 3 ||
            ingredientDefinitions.some((v) => v.tags.includes("unhealthy"))) {
            return "pod_farm:unhealthy_ice_cream";
        }
        else if (ingredientDefinitions.every((v) => v.tags !== undefined && v.tags.includes("fruit"))) {
            return "pod_farm:fruity_ice_cream";
        }
        else {
            return "pod_farm:suspicious_ice_cream";
        }
    }
    else if (items.includes("minecraft:milk_bucket") ||
        items.includes("pod_farm:oat_milk")) {
        items = items.filter((v) => v !== "pod_farm:oat_milk" && v !== "minecraft:milk_bucket");
        const ingredientDefinitions = items.map((v) => ITEM_DEFINITIONS[v] || { tags: [] });
        if (items.filter((v) => v === "minecraft:sugar").length >= 3 ||
            ingredientDefinitions.some((v) => v.tags.includes("unhealthy"))) {
            return "pod_farm:unhealthy_milkshake";
        }
        const possibleCustomRecipes = CUSTOMIZEABLE_MILKSHAKE_RECIPES.filter((v) => {
            let included = true;
            for (const item of v.required) {
                if (!items.includes(item))
                    included = false;
            }
            return included;
        });
        const match = possibleCustomRecipes.find((v) => {
            const filteredItems = items.filter((item) => !v.required.includes(item));
            if (filteredItems.length < v.minimumRequiredOptionals)
                return false;
            let included = true;
            for (const item of filteredItems) {
                if (!v.optional.includes(item))
                    included = false;
            }
            return included;
        });
        return match === undefined ? "pod_farm:suspicious_milkshake" : match.result;
    }
    else {
        const ingredientDefinitions = items.map((v) => ITEM_DEFINITIONS[v] || { tags: [] });
        if (items.filter((v) => v === "minecraft:sugar").length >= 3 ||
            ingredientDefinitions.some((v) => v.tags.includes("unhealthy"))) {
            return "pod_farm:unhealthy_smoothie";
        }
        const possibleCustomRecipes = CUSTOMIZEABLE_SMOOTHIE_RECIPES.filter((v) => {
            let included = true;
            for (const item of v.required) {
                if (!items.includes(item))
                    included = false;
            }
            return included;
        });
        const match = possibleCustomRecipes.find((v) => {
            const filteredItems = items.filter((item) => !v.required.includes(item));
            if (filteredItems.length < v.minimumRequiredOptionals)
                return false;
            let included = true;
            for (const item of filteredItems) {
                if (!v.optional.includes(item))
                    included = false;
            }
            return included;
        });
        return match === undefined ? "pod_farm:suspicious_smoothie" : match.result;
    }
}
/**
 *
 * @param {Block} block
 */
function getFillEntity$1(block, spawnNew) {
    const entityMatches = block.dimension
        .getEntitiesAtBlockLocation(block.center())
        .filter((v) => v.typeId === "pod_farm:blender_fill");
    if (entityMatches.length === 0) {
        if (!spawnNew)
            return undefined;
        //Using the command here instead of the spawnEntity function because when trying to set the rotation after spawning the entity with the function, it will take a few seconds to rotate
        block.dimension.runCommand(`summon pod_farm:blender_fill ${block.center().x} ${block.center().y - 0.5} ${block.center().z} ${directionToRotation(block.permutation.getState("minecraft:cardinal_direction")).y}`);
        const controller = getFillEntity$1(block, false);
        return controller;
    }
    else if (entityMatches.length === 1) {
        return entityMatches[0];
    }
    else {
        for (let i = 1; i < entityMatches.length; i++) {
            removeFillEntity$1(entityMatches[i]);
        }
        return entityMatches[0];
    }
}
/**
 *
 * @param {Entity} entity
 */
function removeFillEntity$1(entity) {
    if (!entity.isValid())
        return;
    entity.remove();
}

const COOKING_POT_ITEM_WHITELIST = [
    "pod_farm:pasta",
    "pod_farm:pea_seeds",
    "pod_farm:pea",
    "pod_farm:bucket_of_cheese",
    "pod_farm:tomato_sauce",
    "pod_farm:rice",
    "pod_farm:oat",
    "pod_farm:oat_milk",
    "minecraft:brown_mushroom",
    "minecraft:red_mushroom",
    "minecraft:milk_bucket",
    "minecraft:water_bucket",
    "minecraft:wheat",
];
const COOKING_POT_3D_RESULTS = [
    "minecraft:mushroom_stew",
    "pod_farm:potato_soup",
    "pod_Farm:sweet_potato_soup",
    "pod_farm:vegetable_soup",
    "pod_farm:tomato_soup",
];
const COOKING_POT_CONTAINERS = [
    "minecraft:bowl",
    "minecraft:glass_bottle",
    "minecraft:bucket",
];

const itemUseCooldown$2 = new TimerUtil();
const invalidIngredientTimer = new TimerUtil();
const cookingDelay = new TimerUtil();
const COOKING_POT_RECIPES = RECIPE_REGISTRY.filter((v) => v.cooking_blocks.includes("cooking_pot"));
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.hasTag("pod_farm:cooking_pot") &&
        !itemUseCooldown$2.has(event.source.id)) {
        const { block, itemStack, source } = event;
        itemUseCooldown$2.set(source.id, 5);
        const isOnStove = event.block.permutation.matches("pod_farm:stove_top");
        if (COOKING_POT_CONTAINERS.includes(itemStack.typeId)) {
            system.runTimeout(() => {
                if (!isOnStove) {
                    displayWarning(source, "cooking_pot.not_on_stove");
                    return;
                }
                const fillEntity = getFillEntity(block, false);
                if (fillEntity === undefined)
                    return;
                const entityProperties = new JsonProperties(fillEntity);
                const items = entityProperties.readOrDefault("items", []);
                if (items.length === 0) {
                    return;
                }
                if (cookingDelay.has(fillEntity.id)) {
                    displayWarning(source, "cooking_pot.delay");
                    return;
                }
                const recipeMatch = getRecipe(items);
                if (recipeMatch !== undefined) {
                    if (recipeMatch.data.container !== itemStack.typeId) {
                        displayWarning(source, `cooking_pot.use_hint.${recipeMatch.data.container}`);
                        return;
                    }
                    removeFillEntity(fillEntity, false);
                    consumeItem(source, recipeMatch.data.container);
                    source.dimension.spawnItem(new ItemStack(recipeMatch.result[0].item), source.location);
                }
                else {
                    if (invalidIngredientTimer.has(source.id)) {
                        source.onScreenDisplay.setActionBar({
                            rawtext: [
                                { translate: `pod_farm.warn.cooking_pot.invalid_ingredients` },
                                { text: `\n§7` },
                                ...items
                                    .map((v, i) => {
                                    return [
                                        {
                                            translate: getLocalisedItemName(v),
                                        },
                                        {
                                            text: `${i + 1 === items.length
                                                ? "."
                                                : i === 4
                                                    ? ",\n§7"
                                                    : ", "}`,
                                        },
                                    ];
                                })
                                    .flat(),
                            ],
                        });
                    }
                    invalidIngredientTimer.set(source.id, 20);
                }
            });
        }
        if (itemStack.hasTag("minecraft:is_food") ||
            COOKING_POT_ITEM_WHITELIST.includes(itemStack.typeId)) {
            event.cancel = true;
            system.runTimeout(() => {
                const fillEntity = getFillEntity(block, true);
                const entityProperties = new JsonProperties(fillEntity);
                const items = entityProperties.readOrDefault("items", []);
                if (items.length === 9) {
                    displayWarning(source, "cooking_pot.full");
                    return;
                }
                items.push(itemStack.typeId);
                const colors = items.map((v) => ITEM_DEFINITIONS[v]?.color || { r: 245, g: 221, b: 181 });
                let r = 0, g = 0, b = 0;
                for (const color of colors) {
                    r += color.r;
                    g += color.g;
                    b += color.b;
                }
                consumeItem(source, itemStack.typeId, 1);
                const convertsTo = ITEM_DEFINITIONS[itemStack.typeId]?.convertsTo;
                if (convertsTo !== undefined)
                    fillEntity.dimension.spawnItem(new ItemStack(convertsTo), fillEntity.location);
                entityProperties.write("items", items);
                fillEntity.setProperty("pod_farm:red", Math.round(r / items.length));
                fillEntity.setProperty("pod_farm:green", Math.round(g / items.length));
                fillEntity.setProperty("pod_farm:blue", Math.round(b / items.length));
                const molangVariables = new MolangVariableMap();
                molangVariables.setColorRGB("pod_farm_color", {
                    red: Math.round(r / items.length) / 255,
                    green: Math.round(g / items.length) / 255,
                    blue: Math.round(b / items.length) / 255,
                });
                fillEntity.dimension.spawnParticle("pod_farm:cooking_bubbles", addVector(fillEntity.location, { y: 0.5 }), molangVariables);
                block.dimension.playSound("bubble.pop", block.location);
                setItemVisibility(fillEntity, itemStack.typeId, true);
                for (const item of COOKING_POT_3D_RESULTS) {
                    setItemVisibility(fillEntity, item, false);
                }
                const recipe = getRecipe(items);
                if (recipe !== undefined) {
                    setItemVisibility(fillEntity, recipe.result[0]?.item || "NO_ITEM", true);
                    if (!isOnStove)
                        return;
                    cookingDelay.set(fillEntity.id, 30);
                    system.runTimeout(() => {
                        if (compareArrays(items, entityProperties.readOrDefault("items", []))) {
                            block.dimension.playSound("random.potion.brewed", block.location);
                        }
                    }, 25);
                }
            });
        }
    }
});
function setItemVisibility(entity, id, value) {
    if (entity.getProperty(id.replace("minecraft:", "pod_farm:minecraft_")) !==
        undefined) {
        entity.setProperty(id.replace("minecraft:", "pod_farm:minecraft_"), value);
    }
}
function getRecipe(items) {
    const ingredientsList = [...new Set(items)]
        .map((v) => {
        return { item: v, amount: items.filter((item) => item === v).length };
    })
        .sort();
    return COOKING_POT_RECIPES.filter((v) => v.ingredients.length === ingredientsList.length).find((v) => {
        return v.ingredients
            .sort()
            .every((v) => ingredientsList.find((v2) => v.item === v2.item && (v.amount || 1) === v2.amount) !== undefined);
    });
}
/**
 *
 * @param {Block} block
 */
function getFillEntity(block, spawnNew) {
    const entityMatches = block.dimension
        .getEntitiesAtBlockLocation(block.center())
        .filter((v) => v.typeId === "pod_farm:cooking_pot_fill");
    if (entityMatches.length === 0) {
        if (!spawnNew)
            return undefined;
        //Using the command here instead of the spawnEntity function because when trying to set the rotation after spawning the entity with the function, it will take a few seconds to rotate
        block.dimension.runCommand(`summon pod_farm:cooking_pot_fill ${block.center().x} ${block.center().y - 0.5} ${block.center().z} ${directionToRotation(block.permutation.getState("minecraft:cardinal_direction")).y} ~ ${block.permutation.matches("pod_farm:stove_top")
            ? "pod_farm:on_stove"
            : "minecraft:entity_spawned"}`);
        const controller = getFillEntity(block, false);
        return controller;
    }
    else if (entityMatches.length === 1) {
        return entityMatches[0];
    }
    else {
        for (let i = 1; i < entityMatches.length; i++) {
            removeFillEntity(entityMatches[i]);
        }
        return entityMatches[0];
    }
}
/**
 *
 * @param {Entity} entity
 */
function removeFillEntity(entity, dropItems = true) {
    if (!entity.isValid())
        return;
    if (dropItems) {
        const items = new JsonProperties(entity).readOrDefault("items", []);
        for (const item of items) {
            if (ITEM_DEFINITIONS[item]?.convertsTo === undefined)
                entity.dimension.spawnItem(new ItemStack(item), entity.location);
        }
    }
    entity.remove();
}
world.afterEvents.playerBreakBlock.subscribe((event) => {
    if (event.brokenBlockPermutation.matches("pod_farm:iron_pot") ||
        event.brokenBlockPermutation.matches("pod_farm:copper_pot"))
        onCookingPotBreak(event);
});
/**
 *
 * @param {PlayerBreakBlockBeforeEvent} event
 */
function onCookingPotBreak(event) {
    for (const entity of event.block.dimension
        .getEntitiesAtBlockLocation(event.block)
        .filter((v) => v.typeId === "pod_farm:cooking_pot_fill")) {
        removeFillEntity(entity);
    }
}

class PodcrashEvent {
    listeners;
    constructor() {
        this.listeners = [];
    }
    subscribe(listener) {
        this.listeners.push(listener);
    }
    call(eventData) {
        for (const listener of this.listeners) {
            listener(eventData);
        }
    }
}
/**
 * Usage:
    export const exampleEvent = new PodcrashEvent();
 */

const blockAffectedByPistonEvent = new PodcrashEvent();
world.afterEvents.pistonActivate.subscribe((event) => {
    const { block, piston } = event;
    const initialState = piston.state;
    const attachedLocations = piston.getAttachedBlocksLocations();
    let direction;
    switch (block.permutation.getState("facing_direction")) {
        case 0:
            direction = Direction.Down;
            break;
        case 1:
            direction = Direction.Up;
            break;
        case 2:
            direction = Direction.South;
            break;
        case 4:
            direction = Direction.East;
            break;
        case 5:
            direction = Direction.West;
            break;
        default:
            direction = Direction.North;
    }
    const run = system.runInterval(() => {
        try {
            if (initialState !== piston.state) {
                const blocks = attachedLocations.map((v) => {
                    return {
                        previousLocation: v,
                        block: getBlockInDirection(event.dimension, v, direction, event.isExpanding ? 1 : -1),
                    };
                });
                system.clearRun(run);
                for (const affectedBlock of blocks) {
                    if (affectedBlock.previousLocation === undefined ||
                        affectedBlock.block === undefined)
                        continue;
                    blockAffectedByPistonEvent.call({
                        block: affectedBlock.block,
                        previousLocation: affectedBlock.previousLocation,
                        piston: block,
                        dimension: event.dimension,
                    });
                }
            }
        }
        catch (e) {
            warn("Piston Action interrupted by error, ignoring affect on attached blocks.");
            warn(e);
            system.clearRun(run);
        }
    });
});

let index = 0;
const BLOCK_LIST = [
    {
        entity: "pod_farm:grill_controller",
        block: ["pod_farm:grill"],
        offset: { x: 0, y: 0, z: 0 },
        removeCallback: GRILL_COOKING_BLOCK.removeController,
    },
    {
        entity: "pod_farm:blender_fill",
        block: ["pod_farm:blender"],
        offset: { x: 0, y: 0.5, z: 0 },
        removeCallback: removeFillEntity$1,
    },
    {
        entity: "pod_farm:iron_pot_fill",
        block: ["pod_farm:iron_pot", "pod_farm:stove_top"],
        offset: { x: 0, y: 0.5, z: 0 },
        removeCallback: removeFillEntity,
    },
];
system.runInterval(async () => {
    const data = BLOCK_LIST[index];
    const promises = [];
    for (const player of world.getAllPlayers()) {
        promises.push(checkPlayer(player, data));
    }
    Promise.all(promises);
    index = index + 1 === BLOCK_LIST.length ? 0 : index + 1;
}, 60);
/**
 *
 * @param {Player} player
 * @param {*} data
 */
async function checkPlayer(player, data) {
    const promises = [];
    for (const entity of player.dimension.getEntities({
        location: player.location,
        maxDistance: 20,
        type: data.entity,
    })) {
        promises.push(checkEntity(entity, data));
    }
    Promise.all(promises);
}
/**
 *
 * @param {Entity} entity
 * @param {*} data
 */
async function checkEntity(entity, data) {
    const block = entity.dimension.getBlock(entity.location);
    if (block === undefined ||
        !data.block.includes(block.typeId) ||
        !vectorMatches(addVector(entity.location, data.offset), block.center())) {
        data.removeCallback(entity);
        return;
    }
}
blockAffectedByPistonEvent.subscribe((event) => {
    if (event.block.hasTag("pod_farm:break_on_piston_impact")) {
        if (event.block.hasTag("pod_farm:crop")) {
            const layer = event.block.permutation.getState("pod_farm:layer");
            if (layer !== undefined && layer !== 0) {
                const multiBlock = getMultiCrop(event.dimension.getBlock(event.previousLocation), event.block.permutation);
                multiBlock.shift();
                for (const block of multiBlock) {
                    breakBlockSafely(block);
                }
            }
            breakCrop(event.block);
        }
        else if (event.block.hasTag("pod_farm:leaves")) {
            breakLeaves(event.block);
        }
        else {
            breakBlockSafely(event.block);
        }
    }
});

const KETTLE_WATER_SUPPLIES = {
    "minecraft:potion": {
        amount: 1,
        convertsTo: "minecraft:glass_bottle",
    },
};
const KETTLE_RECIPES = [
    {
        key: "coffee",
        in: "pod_farm:coffee",
        out: "pod_farm:cup_of_coffee",
    },
    {
        key: "tea",
        in: "pod_farm:tea",
        out: "pod_farm:cup_of_tea",
    },
    {
        key: "ginger",
        in: "pod_farm:ginger",
        out: "pod_farm:cup_of_ginger_tea",
    },
    {
        key: "cocoa_beans",
        in: "minecraft:cocoa_beans",
        out: "pod_farm:cup_of_hot_chocolate",
    },
];

const itemUseCooldown$1 = new TimerUtil();
const boilingDelay = new TimerUtil();
const MAX_WATER_FILL = 3;
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.hasTag("pod_farm:kettle") &&
        !itemUseCooldown$1.has(event.source.id)) {
        const { block, itemStack, source } = event;
        itemUseCooldown$1.set(source.id, 5);
        const isOnStove = event.block.permutation.matches("pod_farm:stove_top");
        system.runTimeout(() => {
            if (!isOnStove) {
                displayWarning(source, "kettle.not_on_stove");
                return;
            }
            const controller = getController(block, true);
            const fillLevel = controller.getProperty("pod_farm:water_fill");
            const item = controller.getProperty("pod_farm:item");
            const addedFill = KETTLE_WATER_SUPPLIES[itemStack.typeId];
            if (addedFill !== undefined) {
                if (item !== "none") {
                    displayWarning(source, "kettle.deny_water");
                    return;
                }
                if (fillLevel === MAX_WATER_FILL) {
                    displayWarning(source, "kettle.full");
                    return;
                }
                //Patch to disallow usage of actual potions
                if (itemStack.typeId === "minecraft:potion") {
                    const equipment = source.getComponent(EntityEquippableComponent.componentId);
                    if (equipment.getEquipment(EquipmentSlot.Mainhand)?.typeId ===
                        "minecraft:potion") {
                        equipment.setEquipment(EquipmentSlot.Mainhand);
                    }
                    else {
                        return;
                    }
                }
                else {
                    consumeItem(source, itemStack.typeId);
                }
                controller.setProperty("pod_farm:water_fill", Math.min(fillLevel + addedFill.amount, MAX_WATER_FILL));
                if (addedFill.convertsTo)
                    system.runTimeout(() => {
                        source.dimension.spawnItem(new ItemStack(addedFill.convertsTo), source.location);
                    }, 1); //Add a tick delay to fix bug turning item invisible
                block.dimension.playSound("bucket.fill_powder_snow", block.center(), {
                    pitch: 0.9 + Math.random() * 0.2,
                });
                return;
            }
            if (itemStack.typeId === "minecraft:glass_bottle") {
                let itemResult = "minecraft:potion";
                if (item !== "none") {
                    itemResult = KETTLE_RECIPES.find((v) => v.key === item).out;
                    if (boilingDelay.has(controller.id))
                        return;
                }
                if (fillLevel === 0) {
                    displayWarning(source, "kettle.empty");
                    return;
                }
                consumeItem(source, "minecraft:glass_bottle");
                source.dimension.spawnItem(new ItemStack(itemResult), source.location);
                controller.setProperty("pod_farm:water_fill", fillLevel - 1);
                block.dimension.playSound("bucket.fill_powder_snow", block.center(), {
                    pitch: 1.1 + Math.random() * 0.2,
                });
                if (fillLevel === 1)
                    controller.setProperty("pod_farm:item", "none");
                return;
            }
            if (item === "none") {
                const recipe = KETTLE_RECIPES.find((v) => v.in === event.itemStack.typeId);
                if (recipe !== undefined) {
                    if (fillLevel === 0) {
                        displayWarning(source, "kettle.requires_water");
                        return;
                    }
                    controller.setProperty("pod_farm:item", recipe.in.split(":")[1]);
                    consumeItem(source, recipe.in);
                    boilingDelay.set(controller.id, 45);
                    block.dimension.playSound("random.potion.brewed", block.center(), {
                        volume: 0.4,
                        pitch: 0.8,
                    });
                    system.runTimeout(() => {
                        block.dimension.spawnParticle("minecraft:llama_spit_smoke", block.center());
                        block.dimension.playSound("random.potion.brewed", block.center(), {
                            volume: 0.7,
                            pitch: 0.9,
                        });
                    }, 15);
                    system.runTimeout(() => {
                        block.dimension.spawnParticle("minecraft:llama_spit_smoke", block.center());
                        block.dimension.playSound("random.potion.brewed", block.center(), {
                            volume: 1,
                            pitch: 1,
                        });
                    }, 30);
                    system.runTimeout(() => {
                        block.dimension.spawnParticle("minecraft:llama_spit_smoke", block.center());
                        block.dimension.playSound("random.fizz", block.center(), {
                            volume: 1,
                            pitch: 0.8,
                        });
                    }, 40);
                }
            }
            else {
                displayWarning(source, "kettle.has_ingredient");
            }
        });
    }
});
world.afterEvents.playerBreakBlock.subscribe((event) => {
    if (event.brokenBlockPermutation.matches("pod_farm:iron_kettle") ||
        event.brokenBlockPermutation.matches("pod_farm:iron_kettle"))
        onKettleBreak(event);
});
/**
 *
 * @param {PlayerBreakBlockBeforeEvent} event
 */
function onKettleBreak(event) {
    for (const entity of event.block.dimension
        .getEntitiesAtBlockLocation(event.block)
        .filter((v) => v.typeId === "pod_farm:kettle_controller")) {
        removeController(entity);
    }
}
/**
 *
 * @param {Block} block
 */
function getController(block, spawnNew) {
    const entityMatches = block.dimension
        .getEntitiesAtBlockLocation(block.center())
        .filter((v) => v.typeId === "pod_farm:kettle_controller");
    if (entityMatches.length === 0) {
        if (!spawnNew)
            return undefined;
        //Using the command here instead of the spawnEntity function because when trying to set the rotation after spawning the entity with the function, it will take a few seconds to rotate
        block.dimension.runCommand(`summon pod_farm:kettle_controller ${block.center().x} ${block.center().y - 0.5} ${block.center().z} ~ ~ ${block.permutation.matches("pod_farm:stove_top")
            ? "pod_farm:on_stove"
            : "minecraft:entity_spawned"}`);
        const controller = getController(block, false);
        return controller;
    }
    else if (entityMatches.length === 1) {
        return entityMatches[0];
    }
    else {
        for (let i = 1; i < entityMatches.length; i++) {
            removeController(entityMatches[i]);
        }
        return entityMatches[0];
    }
}
/**
 *
 * @param {Entity} entity
 */
function removeController(entity) {
    if (!entity.isValid())
        return;
    entity.remove();
}

const placeables = [
    {
        id: "pod_farm:iron_kettle",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: onKettleBreak,
    },
    {
        id: "pod_farm:iron_pot",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: onCookingPotBreak,
    },
    {
        id: "pod_farm:iron_pan",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: (event) => {
            PAN_COOKING_BLOCK.handleBlockBreak(event);
        },
    },
    {
        id: "pod_farm:copper_kettle",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: onKettleBreak,
    },
    {
        id: "pod_farm:copper_pot",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: onCookingPotBreak,
    },
    {
        id: "pod_farm:copper_pan",
        placeSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakSound: {
            id: "dig.copper",
            soundOptions: { pitch: 0.8 + Math.random() * 0.2 },
        },
        breakCallback: (event) => {
            PAN_COOKING_BLOCK.handleBlockBreak(event);
        },
    },
];
const itemUseCooldown = new TimerUtil();
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (!event.block.permutation.matches("pod_farm:stove_top"))
        return;
    const placeable = placeables.find((v) => v.id === event.itemStack.typeId);
    if (placeable !== undefined &&
        placeables.every((v) => event.block.permutation.getState(v.id) === false) &&
        !itemUseCooldown.has(event.source.id)) {
        itemUseCooldown.set(event.source.id, 3);
        event.cancel = true;
        system.runTimeout(() => {
            event.block.setPermutation(event.block.permutation.withState(event.itemStack.typeId, true));
            consumeItem(event.source, event.itemStack.typeId);
            event.block.dimension.playSound(placeable.placeSound.id, event.block.location, placeable.placeSound.soundOptions);
        });
    }
});
world.beforeEvents.playerBreakBlock.subscribe((event) => {
    if (event.block.permutation.matches("pod_farm:stove_top")) {
        const placedItem = placeables.find((v) => event.block.permutation.getState(v.id));
        if (placedItem !== undefined) {
            event.cancel = true;
            system.runTimeout(() => {
                event.block.setPermutation(event.block.permutation.withState(placedItem.id, false));
                event.block.dimension.spawnItem(new ItemStack(placedItem.id), event.block.center());
                event.block.dimension.playSound(placedItem.breakSound.id, event.block.location, placedItem.breakSound.soundOptions);
                if (placedItem.breakCallback)
                    placedItem.breakCallback(event);
            });
        }
    }
});

world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.permutation.matches("pod_farm:toaster")) {
        const { block, itemStack, source } = event;
        const states = getBreadStates(block.permutation);
        if (itemStack.typeId === "pod_farm:bread_slice") {
            let slot = states.findIndex((v) => v === "empty");
            if (slot === -1) {
                slot = states.findIndex((v) => v === "pod_farm:toast");
                if (slot === -1)
                    return;
                system.runTimeout(() => removeItem(block, slot));
            }
            system.runTimeout(() => addBread(source, block, slot));
        }
    }
});
world.afterEvents.entityHitBlock.subscribe((event) => {
    if (event.hitBlock.permutation.matches("pod_farm:toaster") &&
        event.damagingEntity.typeId === "minecraft:player") {
        const { hitBlock } = event;
        const states = getBreadStates(hitBlock.permutation);
        let slot = states.findIndex((v) => v === "pod_farm:toast");
        if (slot === -1) {
            slot = states.findIndex((v) => v === "pod_farm:bread_slice");
            if (slot === -1)
                return;
        }
        removeItem(hitBlock, slot);
    }
});
world.afterEvents.playerBreakBlock.subscribe((event) => {
    if (event.brokenBlockPermutation.matches("pod_farm:toaster")) {
        removeItem(event.block, 0);
        removeItem(event.block, 1);
        const [slot0, slot1] = getBreadStates(event.brokenBlockPermutation);
        if (slot0 !== "empty")
            event.dimension.spawnItem(new ItemStack(slot0), event.block.center());
        if (slot1 !== "empty")
            event.dimension.spawnItem(new ItemStack(slot1), event.block.center());
    }
});
function removeItem(block, slot) {
    const item = getBreadStates(block.permutation)[slot];
    if (item === "empty")
        return;
    block.setPermutation(block.permutation.withState("pod_farm:bread" + slot, false));
    block.setPermutation(block.permutation.withState("pod_farm:toast" + slot, false));
    block.dimension.spawnItem(new ItemStack(item), block.center());
}
function addBread(player, block, slot) {
    //TODO: Possibly add pitch and volume options
    block.dimension.playSound("open_trapdoor.copper", block.center());
    consumeItem(player, "pod_farm:bread_slice");
    block.setPermutation(block.permutation.withState("pod_farm:bread" + slot, true));
    block.setPermutation(block.permutation.withState("pod_farm:toast" + slot, false));
    system.runTimeout(() => {
        if (block.permutation.getState("pod_farm:bread" + slot)) {
            //TODO: Possibly add pitch and volume options
            block.dimension.playSound("crafter.craft", block.center());
            block.dimension.playSound("tile.piston.in", block.center(), {
                volume: 0.5,
                pitch: 1.8,
            });
            block.setPermutation(block.permutation.withState("pod_farm:bread" + slot, false));
            block.setPermutation(block.permutation.withState("pod_farm:toast" + slot, true));
        }
    }, 20 * 8);
}
/**
 *
 * @param {Block} block
 */
function getBreadStates(permutation) {
    const slot1 = permutation.getState("pod_farm:toast0") === true
        ? "pod_farm:toast"
        : permutation.getState("pod_farm:bread0") === true
            ? "pod_farm:bread_slice"
            : "empty";
    const slot2 = permutation.getState("pod_farm:toast1") === true
        ? "pod_farm:toast"
        : permutation.getState("pod_farm:bread1") === true
            ? "pod_farm:bread_slice"
            : "empty";
    return [slot1, slot2];
}

const REGION_SIZE = 32; //This would hold REGION_SIZE^2 chunks, so for 32 it'd be 1024. This value should not be changed after an update with this version was released
const chunkDiscoveryEvent = new PodcrashEvent();
const chunkMemory = {};
const chunkCache = { queue: {}, regionCache: {} };
async function checkChunk(dimension, chunk) {
    const region = getRegionKey(dimension, chunk);
    const regionProperty = getRegionProperty(region);
    if (!regionProperty.has(chunkToString(chunk))) {
        if (chunkCache.queue[region] === undefined) {
            chunkCache.queue[region] = {
                dimension: dimension,
                chunks: [chunk],
            };
        }
        else if (!chunkCache.queue[region].chunks.some((v) => v.x === chunk.x && v.z === chunk.z)) {
            try {
                dimension.spawnParticle("minecraft:basic_flame_particle", {
                    x: chunk.x * 16 + 8,
                    y: -64,
                    z: chunk.z * 16 + 8,
                });
            }
            catch (e) {
                //Ignore
                return;
            }
            chunkCache.queue[region].chunks.push(chunk);
        }
    }
}
async function checkDimensionChunk(location, isProtected = false, radius = 3, playerId) {
    const currentChunk = getChunk(location);
    if (currentChunk === undefined ||
        currentChunk.x === undefined ||
        currentChunk.z === undefined)
        return;
    if (playerId) {
        if (chunkMatches(chunkMemory[playerId], currentChunk))
            return;
        chunkMemory[playerId] = currentChunk;
    }
    const promises = [];
    for (let x = radius * -1; x < radius + 1; x++) {
        for (let z = radius * -1; z < radius + 1; z++) {
            //   if (Math.abs(x) < 2 && Math.abs(z) < 2) continue;
            promises.push(checkChunk(location.dimension, {
                x: currentChunk.x + x,
                z: currentChunk.z + z,
                isProtected: isProtected,
            }));
        }
    }
    await Promise.all(promises);
}
async function checkPlayerChunk(player, isProtected = false, radius = 3) {
    return checkDimensionChunk({ dimension: player.dimension, ...player.location }, isProtected, radius, player.id);
}
async function checkChunksLoop() {
    let promises = [];
    for (const player of world.getAllPlayers()) {
        promises.push(checkPlayerChunk(player));
    }
    await Promise.all(promises);
    //Complete & Clear Queue
    promises = [];
    for (const region of Object.keys(chunkCache.queue)) {
        const regionProperty = getRegionProperty(region);
        const regionObject = chunkCache.queue[region];
        for (const chunk of regionObject.chunks) {
            regionProperty.add(chunkToString(chunk));
            promises.push(chunkDiscoveryEvent.call({
                dimension: regionObject.dimension,
                chunk: chunk,
            }));
        }
        world.setDynamicProperty(region, Array.from(regionProperty).join("&"));
    }
    chunkCache.queue = {};
    chunkCache.regionCache = {};
    Promise.all(promises);
    system.runTimeout(checkChunksLoop, 40);
}
checkChunksLoop();
function getChunk(location) {
    return {
        x: Math.floor(location.x / 16),
        z: Math.floor(location.z / 16),
    };
}
function getRegionKey(dimension, chunk) {
    return `${dimension.id}_region_${Math.floor(chunk.x / REGION_SIZE)}_${Math.floor(chunk.z / REGION_SIZE)}`;
}
function getRegionProperty(region) {
    return chunkCache.regionCache[region] || getRegionPropertyFromWorld(region);
}
function getRegionPropertyFromWorld(region) {
    let result = new Set();
    const property = world.getDynamicProperty(region);
    if (property !== undefined && typeof property === "string")
        result = new Set(property.split("&"));
    chunkCache.regionCache[region] = result;
    return result;
}
function chunkToString(chunk) {
    return `${chunk.x}_${chunk.z}`;
}
function chunkMatches(a, b) {
    return a?.x === b?.x && a?.z === b?.z;
}

world.afterEvents.playerSpawn.subscribe((event) => {
    if (event.initialSpawn) {
        if (event.player.getDynamicProperty("joinedBefore") === undefined) {
            event.player.setDynamicProperty("joinedBefore", true);
            checkPlayerChunk(event.player, true, 2);
        }
        if (event.player.getSpawnPoint() !== undefined) {
            checkDimensionChunk(event.player.getSpawnPoint(), true, 2);
        }
    }
});
chunkDiscoveryEvent.subscribe((event) => {
    try {
        if (settings.getValue("crop_spawning")?.valueOf() === true)
            attemptPlantGeneration(event, []);
    }
    catch (e) {
        log(e);
    }
});
async function attemptPlantGeneration(event, matches, matchLimit = 1, attempts = 2) {
    attempts--;
    if (attempts === 0 || matches.length === matchLimit) {
        for (const match of matches) {
            if (0.25 >= rand())
                createPlant(match.biomes, match.block);
        }
        return matches.length;
    }
    try {
        const block = event.dimension.getTopmostBlock({
            x: event.chunk.x * 16 + rand(2, 13, true),
            z: event.chunk.z * 16 + rand(2, 13, true),
        });
        if (block === undefined)
            return attemptPlantGeneration(event, matches, matchLimit, attempts);
        const biomes = await getBiomes(event.dimension, block.location);
        if (biomes.length === 0)
            return attemptPlantGeneration(event, matches, matchLimit, attempts);
        if (biomes.includes("biome_6")) {
            if (block.typeId === "minecraft:sand" && block.above()?.isAir) {
                matches.push({ biomes: biomes, block: block });
            }
            return attemptPlantGeneration(event, matches, matchLimit, attempts);
        }
        else {
            if ([
                "minecraft:grass_block",
                "minecraft:dirt",
                "minecraft:podzol",
            ].includes(block.typeId) &&
                block.above()?.isAir) {
                matches.push({ biomes: biomes, block: block });
            }
            return attemptPlantGeneration(event, matches, matchLimit, attempts);
        }
    }
    catch (e) {
        return 0;
    }
}
async function createPlant(biomes, blockIn) {
    const block = blockIn.above();
    if (block === undefined || !block.isAir)
        return;
    const plants = [];
    for (const biome of biomes) {
        plants.push(...BIOME_GROUPS[biome]);
    }
    if (plants.length === 0)
        return;
    const plant = randomSelection(plants);
    if (plant.block !== undefined) {
        try {
            block.setPermutation(BlockPermutation.resolve(plant.block));
        }
        catch (e) { }
    }
    if (plant.treeTypes !== undefined) {
        try {
            attemptPlaceTree(block, plant.treeTypes, 5);
        }
        catch (e) { }
    }
}
const warnCooldown = new TimerUtil();
async function getBiomes(dimension, location) {
    try {
        if (dimension.getEntities({ type: "pod_farm:biome_test" }).length >= 70) {
            const loc = vectorToString(location);
            if (warnCooldown.has(loc))
                return [];
            warnCooldown.set(loc, 20);
            warn(`Skipping Biome Test at ${loc}: Biome Test Entity limit exceeded.`);
            return [];
        }
        const testEntity = dimension.spawnEntity("pod_farm:biome_test", location);
        await system.waitTicks(3);
        return testEntity.getTags().filter((v) => v.match("^biome_[1-8]$"));
    }
    catch (e) {
        //Ignore
        return [];
    }
}

const cooldown = new TimerUtil();
world.beforeEvents.itemUseOn.subscribe((event) => {
    if (!cooldown.has(event.source.id) &&
        event.itemStack.hasTag("minecraft:is_axe") &&
        event.block.hasTag("pod_farm:strippable")) {
        cooldown.set(event.source.id, 3);
        system.runTimeout(() => {
            try {
                event.block.setPermutation(BlockPermutation.resolve(event.block.permutation.type.id.replace("pod_farm:", "pod_farm:stripped_"), event.block.permutation.getAllStates()));
                event.block.dimension.playSound("use.wood", event.block.center(), {
                    pitch: 0.8,
                });
                damageEquipmentSafely(event.source);
            }
            catch (e) {
                error(e);
            }
        });
    }
});

world.beforeEvents.itemUseOn.subscribe((event) => {
    if (event.block.hasTag("pod_farm:leaves") &&
        event.itemStack.typeId === "minecraft:bone_meal") {
        system.runTimeout(() => {
            if (event.source !== undefined) {
                if (isHolding(event.source, "minecraft:bone_meal")) {
                    const newStage = event.source.getGameMode() === GameMode.creative
                        ? 999
                        : rand(1, 2, true);
                    const growth = event.block.permutation.getState("pod_farm:growth");
                    if (growth === undefined || growth === 3)
                        return;
                    boneMealLeaves(event.block, Math.min(3, growth + newStage));
                    consumeItem(event.source, "minecraft:bone_meal");
                }
            }
        }, 1);
    }
});
function boneMealLeaves(block, newStage) {
    block.setPermutation(block.permutation.withState("pod_farm:growth", newStage));
    world.playSound("item.bone_meal.use", block.center());
    block.dimension.spawnParticle("minecraft:crop_growth_emitter", block.center());
}

const VANILLA_CROPS = [
    "minecraft:wheat",
    "minecraft:carrots",
    "minecraft:potatoes",
    "minecraft:beetroot",
    "minecraft:melon_stem",
    "minecraft:pumpkin_stem",
    "minecraft:sweet_berry_bush",
];
system.afterEvents.scriptEventReceive.subscribe((event) => {
    if (event.id === "pod_farm:crow_break") {
        system.runTimeout(() => {
            if (event.sourceEntity === undefined)
                return;
            const block = event.sourceEntity.dimension.getBlock(event.sourceEntity.location);
            if (block === undefined || attemptBreak(block))
                return;
            const below = block.below();
            if (below === undefined)
                return;
            attemptBreak(below);
        }, 2);
    }
});
function attemptBreak(block) {
    if (VANILLA_CROPS.includes(block.typeId)) {
        breakBlockSafely(block);
        return true;
    }
    if (block.hasTag("pod_farm:crop")) {
        breakCrop(block);
        return true;
    }
    return false;
}

const NO_CONVERT = [
    "pod_farm:apple_tree",
    "pod_farm:pear_tree",
    "pod_farm:peach_tree",
    "pod_farm:avocado_tree",
    "pod_farm:lemon_tree",
    "pod_farm:orange_tree",
    "pod_farm:banana_tree",
];
const CONVERSION_MAPPINGS = {
    "pod_farm:bean": "pod_farm:bean_plant",
    "pod_farm:bell_pepper": "pod_farm:bell_pepper_plant",
    "pod_farm:blackberry_bush": "pod_farm:blackberry_bush",
    "pod_farm:blueberry_bush": "pod_farm:blueberry_bush",
    "pod_farm:broccoli": "pod_farm:broccoli_plant",
    "pod_farm:cauliflower": "pod_farm:cauliflower_plant",
    "pod_farm:chili": "pod_farm:chili_plant",
    "pod_farm:coconut": "pod_farm:coconut",
    "pod_farm:coffee_plant": "pod_farm:coffee_plant",
    "pod_farm:corn": "pod_farm:corn_plant",
    "pod_farm:cotton": "pod_farm:cotton_plant",
    "pod_farm:cranberry_bush": "pod_farm:cranberry_bush",
    "pod_farm:cucumber": "pod_farm:cucumber_plant",
    "pod_farm:ginger": "pod_farm:ginger_plant",
    "pod_farm:grape_vine": "pod_farm:grape_vine",
    "pod_farm:kohlrabi": "pod_farm:kohlrabi_plant",
    "pod_farm:lettuce": "pod_farm:lettuce_plant",
    "pod_farm:oat": "pod_farm:oat_plant",
    "pod_farm:onion": "pod_farm:onion_plant",
    "pod_farm:pea": "pod_farm:pea_plant",
    "pod_farm:peanut": "pod_farm:peanut_plant",
    "pod_farm:pineapple_plant": "pod_farm:pineapple_plant",
    "pod_farm:raspberry_bush": "pod_farm:raspberry_bush",
    "pod_farm:rhubarb": "pod_farm:rhubarb_plant",
    "pod_farm:rice": "pod_farm:rice_plant",
    "pod_farm:spinach": "pod_farm:spinach_plant",
    "pod_farm:strawberry_bush": "pod_farm:strawberry_bush",
    "pod_farm:sweet_potato": "pod_farm:sweet_potato_plant",
    "pod_farm:tea_plant": "pod_farm:tea_plant",
    "pod_farm:tomato": "pod_farm:tomato_plant",
    "pod_farm:vanilla": "pod_farm:vanilla_plant",
};
system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        system.runJob(convertAroundPlayer(player));
    }
}, 60);
function* convertAroundPlayer(player) {
    for (const crop of player.dimension.getEntities({
        families: ["pod_farm_crop"],
        excludeTags: ["pod_farm_bu_nc"],
        location: player.location,
        maxDistance: 40,
        closest: 15,
    })) {
        if (NO_CONVERT.includes(crop.typeId)) {
            crop.addTag("pod_farm_bu_nc");
            continue;
        }
        const growth = crop.getProperty("pod_farm:growth");
        if (growth === undefined) {
            crop.remove();
            continue;
        }
        const block = player.dimension.getBlock(addVector(crop.location, { y: 0.2 }));
        if (block === undefined) {
            crop.remove();
            yield;
            continue;
        }
        block.setPermutation(BlockPermutation.resolve(CONVERSION_MAPPINGS[crop.typeId]));
        changeGrowth(block, growth);
        crop.remove();
        yield;
    }
}

const NAMESPACE = "pod_farm";
const integratedAddons = {};
system.afterEvents.scriptEventReceive.subscribe((event) => {
    if (event.id === NAMESPACE + ":ping") {
        world
            .getDimension("overworld")
            .runCommand(`scriptevent ${event.message}:pong ${NAMESPACE}`);
    }
    if (event.id === NAMESPACE + ":pong") {
        if (integratedAddons[event.message] !== undefined)
            integratedAddons[event.message] = true;
    }
});

// Number of ticks to wait before fetching entities to run validation on
const VALIDATION_INTERVAL = 6;
const KNOCKBACK_INTERVAL = 4;
const [overworld, nether, theEnd] = [
    world.getDimension("overworld"),
    world.getDimension("nether"),
    world.getDimension("the_end"),
];
const birdOptions = { families: ["pod_farm_bird"] };
world.afterEvents.entityLoad.subscribe((event) => {
    if (event.entity.matches({ families: ["mob_trampling"] })) {
        event.entity.triggerEvent(settings.getValue("mob_trampling")
            ? "pod_farm:enable_block_breaking"
            : "pod_farm:disable_block_breaking");
    }
});
const UNALLOWED_ITEMS = ["pod_farm:jar", "pod_farm:tin_can_block"];
async function removeUnallowedItems() {
    try {
        for (const player of world.getAllPlayers()) {
            const container = player.getComponent(EntityInventoryComponent.componentId)?.container;
            if (container !== undefined) {
                for (let i = 0; i < container.size; i++) {
                    if (UNALLOWED_ITEMS.includes(container.getItem(i)?.typeId || ""))
                        container.setItem(i);
                }
            }
        }
    }
    catch (e) {
        await log(`Error in removeUnallowedItems() : §c${e}`);
    }
}
async function applySlowFallingToBirds() {
    try {
        [
            ...overworld.getEntities(birdOptions),
            ...nether.getEntities(birdOptions),
            ...theEnd.getEntities(birdOptions),
        ].forEach((entity) => {
            if (!entity.isOnGround) {
                const { x, y, z } = entity.getVelocity();
                if (y < 0)
                    entity.applyKnockback(x, z, Math.sqrt(x * x + z * z), 0.04 * KNOCKBACK_INTERVAL);
            }
        });
    }
    catch (e) {
        await log(`Error in applySlowFallingToBirds() : §c${e}`);
    }
}
async function runEntityValidations() {
    try {
        const entitiesValidated = new Set();
        world.getAllPlayers().forEach((player) => {
            player.dimension
                .getEntities({
                families: ["pod_farm_scarecrow"],
                location: player.location,
                maxDistance: 10,
            })
                .forEach((entity) => {
                if (!entitiesValidated.has(entity.id)) {
                    const a = entity.getDynamicProperty("pod_farm:location");
                    const b = entity.location;
                    if (a === undefined) {
                        entity.setDynamicProperty("pod_farm:location", b);
                    }
                    else {
                        if (a.x !== b.x || a.y !== b.y || a.z !== b.z) {
                            entity.runCommand("event entity @s pod_farm:despawn");
                        }
                    }
                    entitiesValidated.add(entity.id);
                }
                else {
                    log(`entity(${entity.id}) skipped due to already having been validated, validation attempt run from player(${player.id})`);
                }
            });
        });
    }
    catch (e) {
        await log(`Error in runEntityValidations() : §c${e}`);
    }
}
// Note: Each call of this function is not guaranteed to have run after the previous call
async function tick() {
    const tick = system.currentTick;
    const promises = [];
    // Bird slow falling, intentionally not awaited
    // Only validate on every so many ticks (Performance)
    if (tick % KNOCKBACK_INTERVAL === 0) {
        promises.push(applySlowFallingToBirds());
    }
    // Crop validation
    // Only validate crops every half second (Performance)
    if (tick % VALIDATION_INTERVAL === 0) {
        // Entity validations are not awaited to save performance
        promises.push(runEntityValidations());
    }
    if (tick % 15 === 0) {
        promises.push(removeUnallowedItems());
        promises.push(displayPinnedRecipe());
    }
    await Promise.all(promises);
}
async function setup() {
    await log("Setup");
    system.runInterval(() => tick());
    /*
      Stats Tracking Code Start - Initialisation
      */
    if (world.scoreboard.getObjective("pod_farm:jig_computer.addon_stats") ===
        undefined) {
        world.scoreboard.addObjective("pod_farm:jig_computer.addon_stats", "");
    }
    /*
      Stats Tracking Code End
      */
}
system.runTimeout(async () => setup(), 150);
system.afterEvents.scriptEventReceive.subscribe((event) => {
    if (event.id === "pod_farm:scan_tree" && event.sourceEntity !== undefined) {
        const raycast = event.sourceEntity.getBlockFromViewDirection({
            maxDistance: 5,
            includeTypes: ["minecraft:diamond_block"],
        });
        if (raycast === undefined)
            return;
        const tree = { blocksUsed: [], layers: [] };
        let root = raycast.block.above();
        let next = true;
        while (next) {
            const layer = scanLayer(root, tree.blocksUsed);
            if (layer.length === 0) {
                next = false;
            }
            else {
                tree.layers.push(layer);
                root = root?.above();
            }
        }
        console.warn(JSON.stringify(tree));
    }
});
function scanLayer(center, blocks) {
    const layer = [];
    for (let x = -3; x < 4; x++) {
        for (let z = -3; z < 4; z++) {
            const block = center.dimension.getBlock(addVector(center.location, { x: x, z: z }));
            if (block === undefined || block?.isAir)
                continue;
            let states = block.permutation.getAllStates();
            if (block.hasTag("pod_farm:leaves") &&
                block.typeId !== "pod_farm:banana_leaf")
                states = { "pod_farm:persistent": false };
            let index = blocks.findIndex((v) => v.typeId === block.permutation.type.id &&
                compareRecords(v.states, states));
            if (index === -1)
                index =
                    blocks.push({
                        typeId: block.permutation.type.id,
                        states: states,
                    }) - 1;
            layer.push({ offset: { x: x, z: z }, block: index });
        }
    }
    return layer;
}

export { tick };
