import { system } from "@minecraft/server";
import ItemModule from "modules/itemModule";

const modules = [
    new ItemModule()
];
let currentTick = 0;
function setupModuleTickIntervals() {
    system.runInterval(() => {
        modules.forEach((module) => {
            module.tickIntervals.forEach((callback, tickInterval) => {
                if (currentTick % tickInterval === 0) {
                    try {
                        callback.call(module);
                    }
                    catch (error) {
                        console.error(`[${module.constructor.name}] Error:`);
                        throw error;
                    }
                }
            });
        });
        currentTick++;
    }, 1); // Run this every tick
}
modules.forEach((module) => {
    module.initialize();
});
setupModuleTickIntervals();
