Skip to content

Commit

Permalink
fix: Correctly install legacy forge < 1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Feb 5, 2023
1 parent 5d44eda commit 9dc504c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
2 changes: 1 addition & 1 deletion xmcl
13 changes: 10 additions & 3 deletions xmcl-keystone-ui/locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,17 @@ edit: Edit
error:
name: Error | Errors
errors:
BadForgeInstallerJarError: >-
Cannot parse forge installer jar file. Maybe the forge has new installer
file format? Contact developers if this issue persisted.
BodyTimeoutError: HTTP Body timeout
ChecksumNotMatchError: Checksum not matched! Expect {expect}. Actual {actual}.
ConnectTimeoutError: Connection timeout to server.
DNSNotFoundError: DNS lookup error
DownloadAggregateError: Fail to download file.
DownloadFileSystemError: >-
Error during accessing the download file path. Please ensure the launcher
has permission to write on it.
HeadersTimeoutError: HTTP Header timeout
SocketError: Server socket error
exception:
Expand Down Expand Up @@ -777,9 +783,10 @@ multiplayer:
"Please copy the local SDP text and send it to your object to have your
object enter this text in the join connection <span>A token can be only used
for <span style="color: red; font-weight: bold;">one peer</span>! You cannot
send the same token to multiple peer!</span> <br> <span class="hint-text" style="font-style: italic;">If you need to connect multiple
peers, you need to create <span style="font-weight: bold; color: rgba(245,
158, 11)">multiple</span> connections.</span>"
send the same token to multiple peer!</span> <br> <span class="hint-text"
style="font-style: italic;">If you need to connect multiple peers, you need
to create <span style="font-weight: bold; color: rgba(245, 158,
11)">multiple</span> connections.</span>"
createGroup: ''
createLocalToken: Create Local Token
currentIpTitle: Detectd Public IP
Expand Down
7 changes: 4 additions & 3 deletions xmcl-keystone-ui/locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,12 @@ download: 下载
downloadCount: '{count} 次下载'
edit: 编辑
errors:
BadForgeInstallerJarError: 无法解析 Forge 安装包 jar 文件。也许 Forge 有了新的安装包格式?如果经常遇到这个问题,请联系开发团队。
BodyTimeoutError: 等待 HTTP 数据超时
ChecksumNotMatchError: 文件校验失败!期望哈希值是 {expect},实际获取到的是 {actual}。
ConnectTimeoutError: 与服务器建立连接超时
DownloadAggregateError: 下载文件失败。
DownloadFileSystemError: 无法访问下载目标路径,请确认启动器有权写入目标路径。
HeadersTimeoutError: 等待 HTTP 头信息超时
SocketError: 与服务器连接被断开
exception:
Expand Down Expand Up @@ -790,9 +792,8 @@ multiplayer:
copyLocalHint: >
<span>一段令牌只能用<span style="color: red;
font-weight:bold;">一次</span>!你不能将一个令牌发送给多个小伙伴!</span> <br> <span
class="hint-text" style="font-style:
italic;">如果有多个小伙伴要加入你需要<span style="font-weight: bold; color: rgba(245, 158,
11)">多次</span>建立连接。</span>
class="hint-text" style="font-style: italic;">如果有多个小伙伴要加入你需要<span
style="font-weight: bold; color: rgba(245, 158, 11)">多次</span>建立连接。</span>
createGroup: ''
createLocalToken: 创建本地令牌
currentIpTitle: 检测到公网 IP
Expand Down
14 changes: 14 additions & 0 deletions xmcl-keystone-ui/src/views/AppTaskDialogTaskViewMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineComponent({
const tError = useLocaleError()
return () => {
const resolve = (m: any) => {
markRaw(m)
if (m.name === 'DownloadAggregateError') {
return h('div', [
h('div', [
Expand Down Expand Up @@ -83,6 +84,19 @@ export default defineComponent({
if (m.name === 'Error' && typeof m.message === 'string') {
return h('div', m.message)
}
if (m.name === 'BadForgeInstallerJarError') {
return h('div', [
h('div', ['🔗 ', h('a', { attrs: { href: `file:///${m.jarPath}` } }, m.jarPath)]),
h('div', t('errors.BadForgeInstallerJarError')),
])
}
if (m.name === 'DownloadFileSystemError') {
return h('div', [
h('div', ['🔗 ', h('a', { attrs: { href: `file:///${m.destination}` } }, m.destination)]),
h('div', t('errors.DownloadFileSystemError')),
m.message,
])
}
return h('div', m.name)
}
if (typeof props.value === 'string') {
Expand Down
2 changes: 1 addition & 1 deletion xmcl-runtime-api/src/entities/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export function isSameForgeVersion(forgeVersion: string, version: string, minecr
if (i === -1) {
return forgeVersion === version
}
return forgeVersion === version.substring(i + 1)
return forgeVersion === version.substring(i + 1) || forgeVersion === version.substring(0, i)
}
export function isSameOptifineVersion(optifineVersion: string, version: string) {
const i = version.indexOf('_')
Expand Down
3 changes: 2 additions & 1 deletion xmcl-runtime/lib/services/InstallService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export class InstallService extends AbstractService implements IInstallService {
version = await this.submit(installForgeTask(options, this.getPath(), {
...installOptions,
java: java.path,
inheritsFrom: options.mcversion,
}).setName('installForge', { id: options.version }))
this.log(`Success to install forge ${options.version} on ${options.mcversion}`)
break
Expand All @@ -549,7 +550,7 @@ export class InstallService extends AbstractService implements IInstallService {
}
this.warn(`An error ocurred during download version ${options.version}@${options.mcversion}`)
this.warn(err)
break
throw err
}
}
return version
Expand Down
13 changes: 8 additions & 5 deletions xmcl-runtime/lib/services/InstanceVersionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ export class InstanceVersionService extends StatefulService<InstanceVersionState
try {
this.fixingAll = true
const { minecraft, forge, fabricLoader, optifine, quiltLoader } = issue
const version = await this.installRuntime({ minecraft, forge, fabricLoader, optifine, quiltLoader })
if (version) {
await this.versionService.refreshVersion(version)
await this.installService.installDependencies(version)
try {
const version = await this.installRuntime({ minecraft, forge, fabricLoader, optifine, quiltLoader })
if (version) {
await this.versionService.refreshVersion(version)
await this.installService.installDependencies(version)
}
} catch (e) {
this.warn('Fail to fix version issue %o', e)
}
} finally {
this.fixingAll = false
Expand Down Expand Up @@ -83,7 +87,6 @@ export class InstanceVersionService extends StatefulService<InstanceVersionState
if (quiltLoader) {
await installService.installQuiltUnsafe({ version: quiltLoader, minecraftVersion: minecraft })
}
// TODO: check liteloader
} else {
this.emit('error', new InstanceVersionException({ type: 'fixVersionNoVersionMetadata', minecraft }))
}
Expand Down

0 comments on commit 9dc504c

Please sign in to comment.