mirror of
https://github.com/artegoser/pimi-launcher-core.git
synced 2024-11-06 05:33:58 +03:00
HOTFIX assetRoot override didnt change for index.
This commit is contained in:
parent
df8e361db8
commit
1866c237b0
2 changed files with 6 additions and 7 deletions
|
@ -142,12 +142,13 @@ class Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAssets () {
|
async getAssets () {
|
||||||
if (!fs.existsSync(path.join(this.options.root, 'assets', 'indexes', `${this.version.assetIndex.id}.json`))) {
|
const assetDirectory = path.resolve(this.options.overrides.assetRoot) || path.join(this.options.root, 'assets')
|
||||||
await this.downloadAsync(this.version.assetIndex.url, path.join(this.options.root, 'assets', 'indexes'),
|
if (!fs.existsSync(path.join(assetDirectory, 'indexes', `${this.version.assetIndex.id}.json`))) {
|
||||||
|
await this.downloadAsync(this.version.assetIndex.url, path.join(assetDirectory, 'indexes'),
|
||||||
`${this.version.assetIndex.id}.json`, true, 'asset-json')
|
`${this.version.assetIndex.id}.json`, true, 'asset-json')
|
||||||
}
|
}
|
||||||
|
|
||||||
const index = JSON.parse(fs.readFileSync(path.join(this.options.root, 'assets', 'indexes', `${this.version.assetIndex.id}.json`), { encoding: 'utf8' }))
|
const index = JSON.parse(fs.readFileSync(path.join(assetDirectory, 'indexes', `${this.version.assetIndex.id}.json`), { encoding: 'utf8' }))
|
||||||
|
|
||||||
this.client.emit('progress', {
|
this.client.emit('progress', {
|
||||||
type: 'assets',
|
type: 'assets',
|
||||||
|
@ -158,7 +159,6 @@ class Handler {
|
||||||
await Promise.all(Object.keys(index.objects).map(async asset => {
|
await Promise.all(Object.keys(index.objects).map(async asset => {
|
||||||
const hash = index.objects[asset].hash
|
const hash = index.objects[asset].hash
|
||||||
const subhash = hash.substring(0, 2)
|
const subhash = hash.substring(0, 2)
|
||||||
const assetDirectory = this.options.overrides.assetRoot || path.join(this.options.root, 'assets')
|
|
||||||
const subAsset = path.join(assetDirectory, 'objects', subhash)
|
const subAsset = path.join(assetDirectory, 'objects', subhash)
|
||||||
|
|
||||||
if (!fs.existsSync(path.join(subAsset, hash)) || !await this.checkSum(hash, path.join(subAsset, hash))) {
|
if (!fs.existsSync(path.join(subAsset, hash)) || !await this.checkSum(hash, path.join(subAsset, hash))) {
|
||||||
|
@ -176,7 +176,6 @@ class Handler {
|
||||||
|
|
||||||
// Copy assets to legacy if it's an older Minecraft version.
|
// Copy assets to legacy if it's an older Minecraft version.
|
||||||
if (this.isLegacy()) {
|
if (this.isLegacy()) {
|
||||||
const assetDirectory = this.options.overrides.assetRoot || path.join(this.options.root, 'assets')
|
|
||||||
this.client.emit('debug', `[MCLC]: Copying assets over to ${path.join(assetDirectory, 'legacy')}`)
|
this.client.emit('debug', `[MCLC]: Copying assets over to ${path.join(assetDirectory, 'legacy')}`)
|
||||||
|
|
||||||
this.client.emit('progress', {
|
this.client.emit('progress', {
|
||||||
|
@ -474,7 +473,7 @@ class Handler {
|
||||||
let args = type.minecraftArguments
|
let args = type.minecraftArguments
|
||||||
? type.minecraftArguments.split(' ')
|
? type.minecraftArguments.split(' ')
|
||||||
: type.arguments.game
|
: type.arguments.game
|
||||||
const assetRoot = this.options.overrides.assetRoot || path.join(this.options.root, 'assets')
|
const assetRoot = path.resolve(this.options.overrides.assetRoot) || path.join(this.options.root, 'assets')
|
||||||
const assetPath = this.isLegacy()
|
const assetPath = this.isLegacy()
|
||||||
? path.join(assetRoot, 'legacy')
|
? path.join(assetRoot, 'legacy')
|
||||||
: path.join(assetRoot)
|
: path.join(assetRoot)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "minecraft-launcher-core",
|
"name": "minecraft-launcher-core",
|
||||||
"version": "3.14.4",
|
"version": "3.14.5",
|
||||||
"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": {
|
||||||
|
|
Loading…
Reference in a new issue