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

const ItemFoodEffectsComponent = {
    onConsume({ source }, { params }) {
        source.playMusic("usa_anthem");
        for (const { name, duration, amplifier } of params) {
            source.addEffect(name, duration, { amplifier })
        }
    },
};

system.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
    itemComponentRegistry.registerCustomComponent("stupidstuff:potion_usa", ItemFoodEffectsComponent);
});