import { system, world, ItemStack } from '@minecraft/server';
import './customComponents/blockComponents';
if (world.getDynamicProperty("jukeboxes") == undefined) world.setDynamicProperty("jukeboxes", JSON.stringify({}));
system.runInterval(()=>{
    for (const player of world.getAllPlayers()){
        const inv = player.getComponent("inventory");
        for(let i = 0; i < inv.container.size; i++){
            if (inv.container.getItem(i) != undefined) {
                const item = inv.container.getItem(i);
                if (item.typeId == 'minecraft:jukebox') {
                    const newItem = new ItemStack("moremusicdiscs:jukebox", item.amount);
                    newItem.nameTag = '§r§fJukebox';
                    inv.container.setItem(i, newItem);
                }
            }
        }
    }
}, 5);
