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


const chestEffect = {
    "just:inflatable_trex": ["invisibility", { showParticles: false }],
    "just:easter_bunny": ["invisibility", { showParticles: false }],
    "just:easter_bunny_costume": ["invisibility", { showParticles: false }],
    "just:sus": ["invisibility", { showParticles: false }],
    "just:sus_imposter": ["invisibility", { showParticles: false }],
    "just:castle_crasher": ["invisibility", { showParticles: false }],
    "just:tenna_costume": ["invisibility", { showParticles: false }],  
    "just:general_chungus_costume": ["invisibility", { showParticles: false }],    
    "just:shake_zula": ["invisibility", {showParticles: false}]  
};


system.runInterval(() => {
    for (const player of world.getPlayers()) {
        const equipment = player.getComponent("minecraft:equippable");
        if (!equipment) continue;

        const chest = equipment.getEquipment("Chest");
        if (!chest) continue;

        const effectData = chestEffect[chest.typeId];
        if (!effectData) continue;

        player.addEffect(effectData[0], 12, effectData[1])
    }
}, 10); // 0.5 seconds
