Fix assets from not loading

This commit is contained in:
Pierce 2022-08-28 19:40:57 -07:00
parent 0f28669e08
commit 61e4c666db
3 changed files with 6 additions and 5 deletions

View file

@ -2,7 +2,7 @@
##### This project is complete for now. ##### This project is complete for now.
[![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core) [![Build Status](https://travis-ci.com/Pierce01/MinecraftLauncher-core.svg?branch=master)](https://travis-ci.com/Pierce01/MinecraftLauncher-core)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![version](https://img.shields.io/badge/stable_version-3.16.11-blue) ![version](https://img.shields.io/badge/stable_version-3.16.14-blue)
![badge](https://img.shields.io/badge/ncurses-not_supported-purple) ![badge](https://img.shields.io/badge/ncurses-not_supported-purple)
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself. MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself.

View file

@ -142,12 +142,13 @@ class Handler {
async getAssets () { async getAssets () {
const assetDirectory = path.resolve(this.options.overrides.assetRoot || path.join(this.options.root, 'assets')) const assetDirectory = path.resolve(this.options.overrides.assetRoot || path.join(this.options.root, 'assets'))
if (!fs.existsSync(path.join(assetDirectory, 'indexes', `${this.version.assetIndex.id}.json`))) { const assetId = this.options.version.custom || this.options.version.number
if (!fs.existsSync(path.join(assetDirectory, 'indexes', `${assetId}.json`))) {
await this.downloadAsync(this.version.assetIndex.url, path.join(assetDirectory, 'indexes'), await this.downloadAsync(this.version.assetIndex.url, path.join(assetDirectory, 'indexes'),
`${this.version.assetIndex.id}.json`, true, 'asset-json') `${assetId}.json`, true, 'asset-json')
} }
const index = JSON.parse(fs.readFileSync(path.join(assetDirectory, 'indexes', `${this.version.assetIndex.id}.json`), { encoding: 'utf8' })) const index = JSON.parse(fs.readFileSync(path.join(assetDirectory, 'indexes', `${assetId}.json`), { encoding: 'utf8' }))
this.client.emit('progress', { this.client.emit('progress', {
type: 'assets', type: 'assets',

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.16.13", "version": "3.16.14",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {