// customComponentEventHooks.js
import { world } from "@minecraft/server";
import CustomComponentHandlerManager from './CustomComponentHandlerManager';
import itemHandlers from '../itemFunctions/index';
import BlockHandlers from '../blockFunctions/index';

export class CustomComponentEventHooks {
    constructor() {
        this.handlerManager = new CustomComponentHandlerManager();
        this.registerHandlers();
    }

    registerHandlers() {
        this.handlerManager.registerItemHandlers(itemHandlers);
        this.handlerManager.registerBlockHandlers(BlockHandlers);
    }

    setup() {
        world.beforeEvents.worldInitialize.subscribe((initEvent) => {
            this.handlerManager.applyHandlers(initEvent);
        });
    }
}
