Bookshelf

Bookshelf

230M Downloads

AWT usage on macOS

comp500 opened this issue ยท 1 comments

commented

I understand that the 1.14.3 port may be a work in progress, however I am submitting this issue just to let you know that RenderUtils.saveTextureToFile() is unlikely to work in 1.14.3 on macOS.

This is due to the switch to LWJGL3 in Minecraft 1.13, which is incompatible with AWT's native libraries on macOS. To prevent this from breaking the game, Mojang enabled the java.awt.headless property, which ensures that the libraries do not load and throws a HeadlessException when a function is called that requires them - see the Forge issue here. I don't know if this will break your code on all systems but it seems likely, and it is a good idea to stop using AWT entirely in case it causes other issues.

I think the correct way to save an image as a file on 1.14.3 is using the stb_image bindings in LWJGL - see how Minecraft does screenshot capturing (NativeImage has a write() function that saves a file).

I am doing this because one of my mods (Screenshot to Clipboard) ran into this issue, and I would like to ensure that other mods know about this.

commented

Closing this because testing has shown that ImageIO seems to work on macOS, as far as I know. It would still be a good idea to move away from using AWT anyway, but this is not an urgent issue.