import * as utils from "../utils/index";
import { MOB_EQUIPMENT } from "../shared/index";
export const EQUIP_TYPES = [
    "minecraft:bogged",
    "minecraft:drowned",
    "minecraft:husk",
    "minecraft:piglin_brute",
    "minecraft:piglin",
    "minecraft:pillager",
    "minecraft:skeleton",
    "minecraft:stray",
    "minecraft:vex",
    "minecraft:vindicator",
    "minecraft:wither_skeleton",
    "minecraft:zombie_pigman",
    "minecraft:zombie",
];
export class EquipmentActor extends utils.Actor {
    constructor() {
        super(...arguments);
        this.equipmentMap = {};
    }
    get EquipmentMap() {
        return this.equipmentMap;
    }
    onConstructed() {
        // Wait one tick for the equipment loot to be applied
        utils.waitForEvent(1, () => {
            if (!this.isValid())
                return;
            for (const [slot, items] of Object.entries(MOB_EQUIPMENT)) {
                for (const item of items) {
                    if (this.runCommand(`testfor @s[hasitem={item=${item},location=${slot}}]`).successCount) {
                        this.equipmentMap[slot] = item;
                        break;
                    }
                }
            }
        });
    }
}
EQUIP_TYPES.forEach(type => {
    utils.Actor.makeActors({ type }, EquipmentActor);
});
