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

world.beforeEvents.worldInitialize.subscribe(e => {
    e.itemComponentRegistry.registerCustomComponent('mc_ark:narcoberry', { 
        onConsume({ itemStack, source }) {
            // Duración de 25 segundos (500 ticks)
            const duration = 25 * 20;
            source.addEffect('slowness', duration, {
                showParticles: false,
                amplifier: 2
            });
            source.addEffect('darkness', duration, {
                showParticles: false,
                amplifier: 2
            });
        }
    });
});