import { world } from "@minecraft/server";
import { JsonDatabase } from "../U/database";
import { wardingDatabaseId } from "../DATA/Config";
let wardLocations = new Map();
const wardingDatabase = new JsonDatabase(world, wardingDatabaseId);
export function addWardLocation(log, entity) {
    wardLocations.set(entity.id, entity.location);
}
export function removeWardLocation(log, entity) {
    if (wardLocations.has(entity.id)) {
        wardLocations.delete(entity.id);
    }
}
export function getWardLocations() {
    return Array.from(wardLocations.values());
}
export function saveWardLocations() {
    try {
        const obj = {};
        wardLocations.forEach((value, key) => {
            obj[key] = value;
        });
        const res = JSON.stringify(obj);
        wardingDatabase.set("kicuMountsWardingData", res);
    }
    catch (error) { }
}
export function loadWardLocations() {
    try {
        wardLocations = new Map(Object.entries(JSON.parse(wardingDatabase.get("kicuMountsWardingData"))));
    }
    catch (error) { }
}

//# sourceMappingURL=../../../../../_KiCuMountsBPDebug/kicu/mmad/C/Warding.js.map
