import { world } from "@minecraft/server";

// Open UIs
world.afterEvents.itemUse.subscribe(event => {
    const { itemStack, source } = event;

    if (itemStack?.typeId === "peach:notebook") {
        if (typeof globalThis.openNotebookUI === "function") {
            globalThis.openNotebookUI(source);
        }
    }

    if (itemStack?.typeId === "peach:cook_book1") {
        if (typeof globalThis.openCookbookUI === "function") {
            globalThis.openCookbookUI(source);
        }
    }
});