import * as mc from "@minecraft/server";
import { SafetyCheckedEntity, mclog } from "./utils/index";
export function initRecipeBoxPlacer() {
    mc.system.afterEvents.scriptEventReceive.subscribe(event => {
        if (event.id === "ldz:recipe_box_placer_on_load" && event.sourceEntity && event.sourceEntity.typeId === "ldz:recipe_box_placer") {
            placeRecipeBox(new SafetyCheckedEntity(event.sourceEntity));
        }
    });
}
function placeRecipeBox(placer) {
    const index = placer.getProperty("ldz:recipe_index");
    if (index) {
        const recipeMob = RECIPES_LIST[index];
        mclog(`${recipeMob} recipe box placed`);
        placer.runCommand(`function shulker_boxes/${recipeMob}`);
    }
    placer.remove();
}
const RECIPES_LIST = [
    "none",
    "allay",
    "armadillo",
    "axolotl",
    "bat",
    "bee",
    "blaze",
    "bogged",
    "breeze",
    "camel",
    "cat",
    "cave_spider",
    "chicken",
    "cod",
    "cow",
    "creeper",
    "dolphin",
    "donkey",
    "drowned",
    "elder_guardian",
    "enderman",
    "endermite",
    "evoker",
    "fox",
    "frog",
    "ghast",
    "glow_squid",
    "goat",
    "guardian",
    "hoglin",
    "horse",
    "husk",
    "iron_golem",
    "llama",
    "magma_cube",
    "mooshroom",
    "mule",
    "ocelot",
    "panda",
    "parrot",
    "phantom",
    "pig",
    "piglin_brute",
    "piglin",
    "pillager",
    "polar_bear",
    "pufferfish",
    "rabbit",
    "ravager",
    "salmon",
    "sheep",
    "shulker",
    "silverfish",
    "skeleton_horse",
    "skeleton",
    "slime",
    "sniffer",
    "snow_golem",
    "spider",
    "squid",
    "stray",
    "strider",
    "tadpole",
    "tropical_fish",
    "turtle",
    "vex",
    "villager",
    "vindicator",
    "wandering_trader",
    "warden",
    "witch",
    "wither_skeleton",
    "wither",
    "wolf",
    "zoglin",
    "zombie_piglin",
    "zombie_villager",
    "zombie",
];
