import { Block, Dimension } from "@minecraft/server";

/**
 * Evento del componente chargedAmethystCrystalComponent
 * @param {{block: Block, dimension: Dimension}} event 
 */
export const chargedAmethystCrystalEvent = ({ block, dimension }) => {
    try {
        if(!block) return;
        let permutation = block.permutation;
        const upgradeState = permutation.getState('nps_ec:upgrade');

        if (upgradeState != 3) {
            permutation = permutation.withState('nps_ec:upgrade', upgradeState + 1)
        }

        block.setPermutation(permutation);
    } catch {}
}