runData doesn't have appropriate VM params on macOS
The IntelliJ task for runData doesn't include the required VM params to run on macOS, specifically missing -XstartOnFirstThread.
[16:06:56] [main/INFO] [ne.mi.us.ArgumentList/]: Duplicate entries for existing Unindexable
[16:06:56] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--all, --mod, jamiemod, --output, /Users/jamie/proj/jamierocks/jamiemod/src/generated/resources, --existing, /Users/jamie/proj/jamierocks/jamiemod/src/generated/resources, --existing, /Users/jamie/proj/jamierocks/jamiemod/src/main/resources, --gameDir, ., --launchTarget, fmluserdevdata, --fml.mcpVersion, 20200515.085601, --fml.mcVersion, 1.15.2, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 31.2.9]
[16:06:56] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 5.1.0+69+master.79f13f7 starting: java version 1.8.0_251 by Oracle Corporation
[16:06:56] [main/INFO] [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
Exception in thread "main" [16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.ExceptionInInitializerError
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:1842)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.fml.loading.progress.ClientVisualization.initWindow(ClientVisualization.java:84)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.fml.loading.progress.ClientVisualization.start(ClientVisualization.java:276)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.fml.loading.progress.EarlyProgressVisualization.accept(EarlyProgressVisualization.java:36)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.fml.loading.FMLLoader.setupLaunchHandler(FMLLoader.java:186)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.fml.loading.FMLServiceProvider.initialize(FMLServiceProvider.java:92)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.TransformationServiceDecorator.onInitialize(TransformationServiceDecorator.java:68)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.TransformationServicesHandler.lambda$initialiseTransformationServices$7(TransformationServicesHandler.java:107)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at java.util.HashMap$Values.forEach(HashMap.java:981)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.TransformationServicesHandler.initialiseTransformationServices(TransformationServicesHandler.java:107)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.TransformationServicesHandler.initializeTransformationServices(TransformationServicesHandler.java:59)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:75)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:65)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:102)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: java.lang.IllegalStateException: GLFW windows may only be created on the main thread and that thread must be the first thread in the process. Please run the JVM with -XstartOnFirstThread. For offscreen rendering, make sure another window toolkit (e.g. AWT or JavaFX) is initialized before GLFW.
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at org.lwjgl.glfw.EventLoop$OffScreen.<clinit>(EventLoop.java:39)
[16:06:57] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: ... 14 more
https://gist.github.com/jamierocks/c75f9b32359faa939ed640d862142927 is my buildscript.
I experience this issue too... You can fix temporarily it by adding this function to your buildscript:
project.ext.isMacos = {
def osProp = System.properties['os.name'].toLowerCase()
return osProp.contains('darwin') || osProp.contains('osx') || osProp.contains('mac')
}
and then adding this to your data run configuration (in minecraft > runs > data):
if (project.ext.isMacos()) {
jvmArg "-XstartOnFirstThread"
}
Then run genIntellijRuns again...
Don't close this as it is still an issue: the runClient automatically runs using -XstartOnFirstThread when on MacOS, so the runData should also automatically run using -XstartOnFirstThread.
Is this still an issue in modern forge (1.18/1.19)?
@SizableShrimp this is no longer a thing on newer versions of Forge, tested in 1.18.2 and 1.19.3 environments. The issue may be closed now.
Okey closing then.