Skip to content

Commit

Permalink
fix: Cannot install neoforge for some 1.20.1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Nov 17, 2024
1 parent 86c5cc5 commit ae69174
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
7 changes: 7 additions & 0 deletions xmcl-keystone-ui/src/composables/instanceVersionInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ function useInstanceVersionInstall(versions: Ref<VersionHeader[]>, servers: Ref<
const neoForgedVersion = await getSWRV(getNeoForgedVersionModel(minecraft), cfg)
const found = neoForgedVersion.find(v => v === neoForged)
const id = found ?? neoForged

if (javas.value.length === 0 || javas.value.every(java => !java.valid)) {
// no valid java
const mcVersionResolved = await resolveLocalVersion(minecraft)
await installDefaultJava(mcVersionResolved.javaVersion)
}

forgeVersion = await installNeoForged({ version: id, minecraft })
} else {
forgeVersion = localNeoForge.id
Expand Down
12 changes: 11 additions & 1 deletion xmcl-runtime/install/InstallService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,17 @@ export class InstallService extends AbstractService implements IInstallService {
for (const java of validJavaPaths) {
try {
this.log(`Start to install neoforge ${options.version} on ${options.minecraft} by ${java.path}`)
version = await this.submit(installNeoForgedTask(options.version.startsWith(options.minecraft) ? 'forge' : 'neoforge', options.version, this.getPath(), {
let target: 'forge' | 'neoforge'
let neoforgeVersion: string
if (options.version.startsWith('47.')) {
// Fix the neoforge version url
neoforgeVersion = `${options.minecraft}-${options.version}`
target = 'forge'
} else {
neoforgeVersion = options.version
target = options.version.startsWith(options.minecraft) ? 'forge' : 'neoforge'
}
version = await this.submit(installNeoForgedTask(target, neoforgeVersion, this.getPath(), {
...installOptions,
java: java.path,
inheritsFrom: options.minecraft,
Expand Down

0 comments on commit ae69174

Please sign in to comment.