Skip to content

Commit 7531db2

Browse files
authored
Merge pull request #1 from phit/master
Merge upstream updates
2 parents f959533 + 717d628 commit 7531db2

File tree

14 files changed

+100
-338
lines changed

14 files changed

+100
-338
lines changed

converter/build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.

converter/src/main/java/io/github/zekerzhayard/forgewrapper/converter/Converter.java

Lines changed: 0 additions & 157 deletions
This file was deleted.

converter/src/main/java/io/github/zekerzhayard/forgewrapper/converter/Main.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

converter/src/main/resources/mmc-pack.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

converter/src/main/resources/patches/net.minecraftforge.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
org.gradle.daemon = false
33

4-
fw_version = mmc3
4+
fw_version = mmc4

jigsaw/src/main/java/io/github/zekerzhayard/forgewrapper/installer/util/ModuleUtil.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.lang.module.ModuleReference;
1010
import java.lang.module.ResolvedModule;
1111
import java.lang.reflect.Field;
12+
import java.net.URL;
1213
import java.nio.file.Path;
1314
import java.nio.file.Paths;
1415
import java.util.HashMap;
@@ -159,6 +160,15 @@ private static class ParserData {
159160
}
160161
}
161162

163+
public static void setupClassPath(Path libraryDir, List<String> paths) throws Throwable {
164+
Class<?> urlClassPathClass = Class.forName("jdk.internal.loader.URLClassPath");
165+
Object ucp = IMPL_LOOKUP.findGetter(Class.forName("jdk.internal.loader.BuiltinClassLoader"), "ucp", urlClassPathClass).invokeWithArguments(ClassLoader.getSystemClassLoader());
166+
MethodHandle addURLMH = IMPL_LOOKUP.findVirtual(urlClassPathClass, "addURL", MethodType.methodType(void.class, URL.class));
167+
for (String path : paths) {
168+
addURLMH.invokeWithArguments(ucp, libraryDir.resolve(path).toUri().toURL());
169+
}
170+
}
171+
162172
// ForgeWrapper need some extra settings to invoke BootstrapLauncher.
163173
public static Class<?> setupBootstrapLauncher(Class<?> mainClass) throws Throwable {
164174
if (!mainClass.getModule().isOpen(mainClass.getPackageName(), ModuleUtil.class.getModule())) {

legacy/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ plugins {
44
id "eclipse"
55
}
66

7+
sourceCompatibility = targetCompatibility = 1.8
8+
compileJava {
9+
sourceCompatibility = targetCompatibility = 1.8
10+
}
11+
712
repositories {
813
mavenCentral()
914
maven {

settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
rootProject.name = 'ForgeWrapper'
22

33
include 'common'
4-
include 'converter'
54
include 'legacy'
65
include 'jigsaw'

src/main/java/io/github/zekerzhayard/forgewrapper/installer/Bootstrap.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ public static void bootstrap(List<String> jvmArgs, String minecraftJar, String l
1515
}
1616
jvmArgs = replacedJvmArgs;
1717

18+
// Remove NewLaunch.jar from property to prevent Forge from adding it to the module path
19+
StringBuilder newCP = new StringBuilder();
20+
for (String path : System.getProperty("java.class.path").split(File.pathSeparator)) {
21+
if (!path.endsWith("NewLaunch.jar")) {
22+
newCP.append(path).append(File.pathSeparator);
23+
}
24+
}
25+
System.setProperty("java.class.path", newCP.substring(0, newCP.length() - 1));
26+
1827
String modulePath = null;
1928
List<String> addExports = new ArrayList<>();
2029
List<String> addOpens = new ArrayList<>();

0 commit comments

Comments
 (0)