mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Forge 1.7.10 lwjgl3ify classpath order
This commit is contained in:
parent
00ab20473c
commit
cc6ed82afb
3 changed files with 22 additions and 9 deletions
|
@ -31,6 +31,9 @@ public static ClientProfile makeProfile(ClientProfile.Version version, String ti
|
|||
builder.setUpdateVerify(List.of("libraries", "natives", "mods", "minecraft.jar", "forge.jar", "liteloader.jar"));
|
||||
{
|
||||
List<String> classPath = new ArrayList<>(5);
|
||||
if(findOption(options, MakeProfileOptionLaunchWrapper.class).isPresent()) {
|
||||
classPath.add("libraries/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar");
|
||||
}
|
||||
classPath.add("libraries");
|
||||
classPath.add("minecraft.jar");
|
||||
if (version.compareTo(ClientProfileVersions.MINECRAFT_1_12_2) <= 0) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public void start(boolean pipeOutput) throws IOException, InterruptedException {
|
|||
if (params.profile.getClassLoaderConfig() == ClientProfile.ClassLoaderConfig.AGENT) {
|
||||
processArgs.add("-javaagent:".concat(IOHelper.getCodeSource(ClientLauncherEntryPoint.class).toAbsolutePath().toString()));
|
||||
} else if (params.profile.getClassLoaderConfig() == ClientProfile.ClassLoaderConfig.SYSTEM_ARGS) {
|
||||
systemClassPath.addAll(ClientLauncherEntryPoint.resolveClassPath(workDir, params.actions, params.profile)
|
||||
systemClassPath.addAll(ClientLauncherEntryPoint.resolveClassPath(new HashSet<>(), workDir, params.actions, params.profile)
|
||||
.filter(x -> !params.profile.getModulePath().contains(workDir.relativize(x).toString()))
|
||||
.map(Path::toString)
|
||||
.toList());
|
||||
|
|
|
@ -118,7 +118,8 @@ private static void realMain(String[] args) throws Throwable {
|
|||
|
||||
// Verify ClientLauncher sign and classpath
|
||||
LogHelper.debug("Verifying ClientLauncher sign and classpath");
|
||||
List<Path> classpath = resolveClassPath(clientDir, params.actions, params.profile)
|
||||
Set<Path> ignoredPath = new HashSet<>();
|
||||
List<Path> classpath = resolveClassPath(ignoredPath, clientDir, params.actions, params.profile)
|
||||
.filter(x -> !profile.getModulePath().contains(clientDir.relativize(x).toString()))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
if(LogHelper.isDevEnabled()) {
|
||||
|
@ -252,11 +253,11 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
|
|||
}
|
||||
}
|
||||
|
||||
private static LinkedList<Path> resolveClassPathList(Path clientDir, String... classPath) throws IOException {
|
||||
return resolveClassPathStream(clientDir, classPath).collect(Collectors.toCollection(LinkedList::new));
|
||||
private static LinkedList<Path> resolveClassPathList(Set<Path> ignorePaths, Path clientDir, String... classPath) throws IOException {
|
||||
return resolveClassPathStream(ignorePaths, clientDir, classPath).collect(Collectors.toCollection(LinkedList::new));
|
||||
}
|
||||
|
||||
private static Stream<Path> resolveClassPathStream(Path clientDir, String... classPath) throws IOException {
|
||||
private static Stream<Path> resolveClassPathStream(Set<Path> ignorePaths, Path clientDir, String... classPath) throws IOException {
|
||||
Stream.Builder<Path> builder = Stream.builder();
|
||||
for (String classPathEntry : classPath) {
|
||||
Path path = clientDir.resolve(IOHelper.toPath(classPathEntry.replace(IOHelper.CROSS_SEPARATOR, IOHelper.PLATFORM_SEPARATOR)));
|
||||
|
@ -265,20 +266,28 @@ private static Stream<Path> resolveClassPathStream(Path clientDir, String... cla
|
|||
IOHelper.walk(path, new ClassPathFileVisitor(jars), false);
|
||||
Collections.sort(jars);
|
||||
for(var e : jars) {
|
||||
if(ignorePaths.contains(e)) {
|
||||
continue;
|
||||
}
|
||||
builder.accept(e);
|
||||
ignorePaths.add(e);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(ignorePaths.contains(path)) {
|
||||
continue;
|
||||
}
|
||||
builder.accept(path);
|
||||
ignorePaths.add(path);
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static Stream<Path> resolveClassPath(Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException {
|
||||
Stream<Path> result = resolveClassPathStream(clientDir, profile.getClassPath());
|
||||
public static Stream<Path> resolveClassPath(Set<Path> ignorePaths, Path clientDir, Set<OptionalAction> actions, ClientProfile profile) throws IOException {
|
||||
Stream<Path> result = resolveClassPathStream(ignorePaths, clientDir, profile.getClassPath());
|
||||
for (OptionalAction a : actions) {
|
||||
if (a instanceof OptionalActionClassPath)
|
||||
result = Stream.concat(result, resolveClassPathStream(clientDir, ((OptionalActionClassPath) a).args));
|
||||
result = Stream.concat(result, resolveClassPathStream(ignorePaths, clientDir, ((OptionalActionClassPath) a).args));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -340,8 +349,9 @@ private ClassPathFileVisitor(List<Path> result) {
|
|||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (IOHelper.hasExtension(file, "jar") || IOHelper.hasExtension(file, "zip"))
|
||||
if (IOHelper.hasExtension(file, "jar") || IOHelper.hasExtension(file, "zip")) {
|
||||
result.add(file);
|
||||
}
|
||||
return super.visitFile(file, attrs);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue