VideoGameSmash12/WNT

When loading 1.19.3 fabric blackbox fails to init

Closed this issue · 34 comments

when I run /blackbox open it gives me the error

java.awt.HeadlessException
	at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
	at java.desktop/java.awt.Window.<init>(Window.java:553)
	at java.desktop/java.awt.Frame.<init>(Frame.java:428)
	at java.desktop/java.awt.Frame.<init>(Frame.java:393)
	at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
	at me.videogamesm12.wnt.blackbox.Blackbox$GUIFrame.<init>(Blackbox.java:226)
	at me.videogamesm12.wnt.blackbox.commands.BlackboxCommand.lambda$run$0(BlackboxCommand.java:59)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)```

You need to run the mod with a non-headless JDK.

For me, I was able to fix the issue by removing this mod:
https://github.com/polina4096/resquake
I have now idea how a mod that modifies movement manages to break WNT, but somehow it did.
I am on 1.19.3

It is reproducible on fresh 1.19.3 and 1.19.4 instances with only re:squake, WNT, and the required libraries.

The only thing I can think that re:squake could be doing to break it is flash a number below your crosshair indicating speed increase/decrease; This is maybe similar to #14 where Custom Crosshair Mod caused an identical issue.

You need to run the mod with a non-headless JDK.

What does this mean as I was just running it with a few performance mods like sodium

You need to run the mod with a non-headless JDK.

What does this mean as I was just running it with a few performance mods like sodium

It means the JDK you currently have installed does not support AWT, and as such, is considered headless. What JDK are you currently using to launch the game?

idk how to figure that out, could you link me to a download of a version that does support it?

idk how to figure that out, could you link me to a download of a version that does support it?

The Eclipse Temurin JDK should support it just fine.

The Eclipse Temurin JDK should support it just fine.

@allinkdev Unless I'm using the wrong one/am doing it wrong, it doesn't.

image
Attached above is the version I downloaded and installed; I then edited my Fabric Installation to use the javaw.exe file located at C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot\bin

Launching Minecraft with WNT, and the Mod that I know causes Blackbox to not open (re:squake) still resulted in the error that this issue was opened for.

For me, I was able to fix the issue by removing this mod: https://github.com/polina4096/resquake I have now idea how a mod that modifies movement manages to break WNT, but somehow it did. I am on 1.19.3

It is reproducible on fresh 1.19.3 and 1.19.4 instances with only re:squake, WNT, and the required libraries.

The only thing I can think that re:squake could be doing to break it is flash a number below your crosshair indicating speed increase/decrease; This is maybe similar to #14 where Custom Crosshair Mod caused an identical issue.

I know that's not my issue as I've tried it with just the dependencies and it still fails to load

I've tried it with just the dependencies and it still fails to load

Ok that is weird. What OS, MC Version, and WNT Version?

I'm able to open it fine on Windows, using a fresh 1.19.4 instance with only WNT, Cloth Config and Fabric API

When I use a mod like resquake or Custom Crosshair Mod though, I get an identical error to yours, so I think the issues are related.

It seems the only AWT-related class ReSquake is using is java.awt.Color. But, regardless of whether or not these mods are using AWT, it shouldn't be throwing an AWT exception. Which is why I personally recommend using something that has nothing to do with AWT or Swing, like imgui-java.

AWT has been terrible, and it always has been.

Found the issue
viafabricplus-2.2.0 - Causes the Error
the one crucial mod to play on the server where this mod would be most useful
so i think this was both due to old Java install not working as my previous version was from 2022 and a mod when i tried it with mu list that was incompatible

viafabricplus-2.2.0

Please update to the latest version of ViaFabricPlus

@encumber I do not believe that this error is due to my mod

latest version of ViaFabricPlus

...which has the same issue regardless, Try a fresh instance with WNT, Cloth Config, Fabric API and VFP 2.3.6

latest version of ViaFabricPlus

...which has the same issue regardless, Try a fresh instance with WNT, Cloth Config, Fabric API and VFP 2.3.6

Even so, that's a version 1 month out of date, lacking a boatload of bug fixes & compatibility fixes.

ViaFabricPlus >2.2.0 also only supports 1.19.4.

This is just strange. Somehow, despite the workaround I put in place to disable headless mode, Java (and AWT) still thinks that it's running in Headless Mode when you have certain combinations of mods in place. Mods usually don't mess with the system properties, so this is just really weird. Do I need to increase how aggressive I am with messing with the parameters to further mitigate the issue? Is a race condition happening somewhere that I don't know about?

This is just strange. Somehow, despite the workaround I put in place to disable headless mode, Java (and AWT) still thinks that it's running in Headless Mode when you have certain combinations of mods in place. Mods usually don't mess with the system properties, so this is just really weird. Do I need to increase how aggressive I am with messing with the parameters to further mitigate the issue? Is a race condition happening somewhere that I don't know about?

In all honesty, this is why I believe dropping everything related to AWT/Swing is the best way for the mod to progress. There's too many workarounds & strange compatibility issues with other mods.

I agree with Allink, ViaFabricPlus does absolutely nothing with Awt, it seems kind of weird

I agree with Allink, ViaFabricPlus does absolutely nothing with Awt, it seems kind of weird

It seems to depend on some AWT classes, but I don't think accessing classes should be causing these kinds of errors, as ViaFabricPlus does not modify anything relating to the headless state of the JVM.

I think this issue is caused by other mods depending on java.awt.Color, and other AWT classes, as the only common link between resquake and ViaFabricPlus is that they both depend on this class. Will test this hypothesis further.

In all honesty, this is why I believe dropping everything related to AWT/Swing is the best way for the mod to progress. There's too many workarounds & strange compatibility issues with other mods.

I don't disagree that AWT and Swing are garbage (because they absolutely are), but I don't know what I would switch to that wouldn't interfere with the main goal of the Blackbox (being a sort of recovery-like environment with the ability to run regardless of the current state of the game). I know we discussed some other library that looked interesting but practically required me to use the main window as the place where the stuff is rendered, and I am really not comfortable with that idea.

I've tried using JavaFX, but the issue is that there are libraries that it needs that just doesn't exist for many Java installations (including the one that comes with the official launcher).

I think this issue is caused by other mods depending on java.awt.Color, and other AWT classes, as the only common link between resquake and ViaFabricPlus is that they both depend on this class. Will test this hypothesis further.

Works for me. Let me know how it goes.

I'm not that into the subject matter right now, but can't you just use ImGui?

I don't disagree that AWT and Swing are garbage (because they absolutely are), but I don't know what I would switch to that wouldn't interfere with the main goal of the Blackbox (being a sort of recovery-like environment with the ability to run regardless of the current state of the game). I know we discussed some other library that looked interesting but practically required me to use the main window as the place where the stuff is rendered, and I am really not comfortable with that idea.

I am pretty sure there is a way to have ImGui on another window

I'm not that into the subject matter right now, but can't you just use ImGui?

That's what I was bringing up earlier when I noted that it practically required me to use the main window.

Will test this hypothesis further

I decompiled Custom Crosshair Mod (since I can't find a source for it), and sure enough, in CustomCrosshairDrawer.java, there's import java.awt.Color;

Works for me. Let me know how it goes.

My hypothesis was correct! It seems like this mod I quickly threw together is able to reproduce the bug by just using java.awt.Color!

EDIT: Published code & fixed link

image

image

Operating System: Void Linux (kernel version 5.19.10_1)
JDK Vendor: OpenJDK, I believe

@VideoGameSmash12 You should be able to reproduce this issue by installing Flatpak (if it isn't already) on your Arch Linux system, installing PrismLauncher, and attempting to load the game on Fabric 1.19.3 with Fabric API, Cloth Config, AWTTest and WNT, and trying to open Blackbox.

What the fuck

This issue with AWTTest apparently seems to be solved by using Quilt Loader. At least it is, in my testing. Please try using it, and seeing if it fixes this issue for you. @encumber @KadTheHunter

apparently seems to be solved by using Quilt Loader

Just tested it, and it does indeed, but then Meteor causes Quilt to crash. So it is a valid workaround, but has its own drawbacks.

apparently seems to be solved by using Quilt Loader

Just tested it, and it does indeed, but then Meteor causes Quilt to crash. So it is a valid workaround, but has its own drawbacks.

Meteor breaks everything, so this is to be expected.

@encumber @KadTheHunter

Please try the "WNT" artifact available from my pull request, and seeing if it solves this compatibility issue.

@allinkdev It works! Able to launch with re:squake and Blackbox opens just fine.

Fixed in v2.0-alpha.9. Thanks, Allink!