修复导入部分整合包失败的问题

This commit is contained in:
Zkitefly 2024-08-23 01:34:23 +00:00
parent d507998e79
commit 98760d9dd4
2 changed files with 11 additions and 1 deletions

View File

@ -129,9 +129,14 @@ public abstract class VersionList<T extends RemoteVersion> {
lock.readLock().lock(); lock.readLock().lock();
try { try {
T result = null; T result = null;
for (T it : versions.get(gameVersion)) TreeSet<T> remoteVersions = versions.get(gameVersion);
for (T it : remoteVersions)
if (remoteVersion.equals(it.getSelfVersion())) if (remoteVersion.equals(it.getSelfVersion()))
result = it; result = it;
if (result == null)
for (T it : remoteVersions)
if (remoteVersion.equals(it.getFullVersion()))
result = it;
return Optional.ofNullable(result); return Optional.ofNullable(result);
} finally { } finally {
lock.readLock().unlock(); lock.readLock().unlock();

View File

@ -31,6 +31,11 @@ public class OptiFineRemoteVersion extends RemoteVersion {
super(LibraryAnalyzer.LibraryType.OPTIFINE.getPatchId(), gameVersion, selfVersion, null, snapshot ? Type.SNAPSHOT : Type.RELEASE, urls); super(LibraryAnalyzer.LibraryType.OPTIFINE.getPatchId(), gameVersion, selfVersion, null, snapshot ? Type.SNAPSHOT : Type.RELEASE, urls);
} }
@Override
public String getFullVersion() {
return getGameVersion() + "_" + getSelfVersion();
}
@Override @Override
public Task<Version> getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) { public Task<Version> getInstallTask(DefaultDependencyManager dependencyManager, Version baseVersion) {
return new OptiFineInstallTask(dependencyManager, baseVersion, this); return new OptiFineInstallTask(dependencyManager, baseVersion, this);