import * as mc from "@minecraft/server";
import * as utils from "../utils/index";
import { MOB_DATA, snapToSurface, waitForInput } from "../shared/index";
utils.afterEvents.scriptEventRecieve.subscribe("ldz_250121:review", async (e) => {
    var _a, _b, _c, _d, _e;
    const player = (_a = e.sourceEntity) === null || _a === void 0 ? void 0 : _a.getPlayer();
    if (!player)
        return;
    const origin = snapToSurface(player.dimension, player.location.add(player.getViewDirection().multiply(5)), player.location.y).up();
    (_b = player.Inventory) === null || _b === void 0 ? void 0 : _b.clearAll();
    const item = new mc.ItemStack("minecraft:stick", 1);
    item.nameTag = "Good";
    (_c = player.Inventory) === null || _c === void 0 ? void 0 : _c.addItem(item);
    item.nameTag = "Bad";
    (_d = player.Inventory) === null || _d === void 0 ? void 0 : _d.addItem(item);
    player.sendMessage(`This will spawn all entities in order and kill them. You will be given a good stick and a bad stick. Use the good stick if the animation is good, and the bad stick if the animation is 
bad. Then the next animation will play.`);
    const badAnims = [];
    for (const [key, value] of Object.entries(MOB_DATA)) {
        try {
            const victim = value.debugEntity ? value.debugEntity(player.dimension, origin) : utils.overworld.spawnEntity(key, origin);
            if (!victim)
                continue;
            await utils.waitForTicks(10);
            victim.kill();
            if (!await waitForInput()) {
                badAnims.push(key);
            }
        }
        catch (error) { }
    }
    (_e = player.Inventory) === null || _e === void 0 ? void 0 : _e.clearAll();
    utils.mclog(`Bad animations: \n${badAnims.join("\n")}`);
});
