def buildResources(version=None, lang=None): 
    """Loads the resource files and builds the resource dictionnaries.
    Four dictionnaries are built. Two for the refering language (English), and two for the language to be used.
    They are 'reversed' dictionnaries; the {foo: bar} pairs of one are the {bar: foo} of the other one."""
    log.debug('Building Minecraft language resources...')
    global enRes
    global serNe
    global langRes
    global serGnal
    global enMisc
    global csimEn
    global langMisc
    global csimGnal
    enRes = {}
    serNe = {}
    langRes = {}
    serGnal = {}
    enMisc = {}
    csimEn = {}
    langMisc = {}
    csimGnal = {}
    if not os.path.exists(indexesDirectory) or not os.path.exists(objectsDirectory):
        log.debug('Minecraft installation directory is not valid.')
        log.debug('Impossible to load the game language resources.')
        return
    _versions = os.listdir(indexesDirectory)
    if 'legacy.json' in _versions:
        _versions.remove('legacy.json')
    if len(_versions) == 0:
        log.debug("No valid versions found in minecraft install directory")
        return
    # Sort the version so '1.8' comes after '1.10'.
    versions = [" "]
    for ver_str in _versions:
        v1 = LooseVersion(ver_str)
        idx = -1
        for i, cur_ver in enumerate(versions):
            v2 = LooseVersion(cur_ver)
            if v1>= v2:
                break
        versions.insert(i, ver_str)
    versions = versions[:-1]
    version_file = "%s.json" % version
    fName = None
    if version_file in versions:
        fName = os.path.join(indexesDirectory, version_file)
    elif version:
        # Let's try to find a corresponding file by reducing the name.
        # E.g: 1.10.2 don't have an asset definition file, but 1.10 have. All the same for the pre-releases...
        if '-' in version:
            version = version.split('-')[0]
        while '.' in version:
            version = version.split('.')
            version_file = "%s.json" % version
            if version_file in versions:
                fName = os.path.join(indexesDirectory, version_file)
                break
    if not fName:
        fName = os.path.join(indexesDirectory, versions[-1])
    log.debug('Using %s' % fName)
    data = open(fName).read()
    name = getResourceName('en_GB', data)
    if name:
        fName = os.path.join(objectsDirectory, name[:2], name)
        if not os.path.exists(fName):
            fName = findResourceFile(name, objectsDirectory)
        if not fName:
            log.debug('Can\'t get the resource %s.' % name)
            log.debug('Nothing built. Aborted')
            return
        log.debug('Found %s' % name)
        lines = codecs.open(fName, encoding='utf_8').readlines()
        for line in lines:
            if line.split('.')[0] in ['book', 'enchantment', 'entity', 'gameMode', 'generator', 'item', 'tile'] and line.split('=')[0].strip() not in excludedEntries:
                enRes[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
                serNe[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
        #lines = codecs.open(os.path.join(getDataDir(), 'Items', 'en_GB'), encoding='utf_8')
        lines = codecs.open(getDataFile('Items', 'en_GB'), encoding='utf_8')
        for line in lines:
            if line.split('.')[0] in ['book', 'enchantment', 'entity', 'gameMode', 'generator', 'item', 'tile'] and line.split('=')[0].strip() not in excludedEntries:
                enRes[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
                serNe[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
            else:
                enMisc[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
                csimNe[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
        log.debug('... Loaded!')
    else:
        return
    if not lang:
        lang = 'en_GB'
    log.debug('Looking for %s resources.' % lang)
    name = getResourceName(lang, data)
    if not name:
        lang = 'en_GB'
        name = getResourceName(lang, data)
    if name:
        fName = os.path.join(objectsDirectory, name[:2], name)
        if not os.path.exists(fName):
            fName = findResourceFile(name, objectsDirectory)
        if not fName:
            log.debug('Can\'t get the resource %s.' % name)
            return
        log.debug('Found %s...' % name)
        lines = codecs.open(fName, encoding='utf_8').readlines()
        for line in lines:
            if line.split('.')[0] in ['book', 'enchantment', 'entity', 'gameMode', 'generator', 'item', 'tile'] and line.split('=')[0].strip() not in excludedEntries:
                langRes[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
                serGnal[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
        #if os.path.exists(os.path.join(getDataDir(), 'Items', lang)):
        if os.path.exists(getDataFile('Items', lang)):
            log.debug("Found Items/%s" % lang)
            #lines = codecs.open(os.path.join(getDataDir(), 'Items', lang), encoding='utf_8')
            lines = codecs.open(getDataFile('Items', lang), encoding='utf_8')
            for line in lines:
                if line.split('.')[0] in ['book', 'enchantment', 'entity', 'gameMode', 'generator', 'item', 'tile'] and line.split('=')[0].strip() not in excludedEntries:
                    langRes[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
                    serGnal[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
                else:
                    langMisc[line.split('=', 1)[0].strip()] = line.split('=', 1)[-1].strip()
                    csimGnal[line.split('=', 1)[-1].strip()] = line.split('=', 1)[0].strip()
        log.debug('... Loaded!')
    else:
        return
Loads the resource files and builds the resource dictionnaries.
    Four dictionnaries are built. Two for the refering language (English), and two for the language to be used.
    They are 'reversed' dictionnaries; the {foo: bar} pairs of one are the {bar: foo} of the other one.
mclangres.py