function random(ary){
    return ary[Math.floor(Math.random()*ary.length)];
}

var carryingBlock = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'kubejs:lootblock_magic_floral', 'kubejs:lootblock_builder', 'kubejs:lootblock_magic_druidic'];



onEvent('entity.spawned', event => {

    if(event.entity.type == 'minecraft:enderman') {
        
        event.server.scheduleInTicks(3, cb => {
        
        var UUID= event.entity.getFullNBT().UUID;
        var cleanUUID = '[I;'+UUID.toString().substring(1);
	  
	  event.server.runCommandSilent('data merge entity @e[nbt={UUID:'+cleanUUID+'},limit=1] {carriedBlockState:{Name:"'+random(carryingBlock)+'"}}');
    });
}
})
