MinecraftMachina / ManyMC

📦 A familiar Minecraft Launcher with native support for macOS arm64 (M1)
GNU General Public License v3.0
500 stars 19 forks source link

Fix color inversion on Minecraft 1.5.2 and before #39

Open ViRb3 opened 2 years ago

ViRb3 commented 2 years ago

Might also be related to #36.

ViRb3 commented 2 years ago

Confirmed to also be happening on MultiMC with original libraries. This is most likely a bug with MacOS's JAWT renderer or OpenGL or both.

ViRb3 commented 2 years ago

With the high DPI patch I applied to LWJGL2 in ManyMC, color inversion and stuttering are gone in fullscreen mode, making this version completely playable. Should still see why it's happening in windowed mode, though.

ViRb3 commented 2 years ago

The closest update that fixes color inversion, which works on ManyMC, is from 1.5.2 to 13w23b. The snapshots from 13w17a to 13w22a crash with:

Failed to start Minecraft:
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)
Caused by: joptsimple.UnrecognizedOptionException: 'width' is not a recognized option
    at joptsimple.OptionException.unrecognizedOption(OptionException.java:89)
    at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:445)
    at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:54)
    at joptsimple.OptionParser.parse(OptionParser.java:385)
    at net.minecraft.client.main.Main.main(SourceFile:35)
Exiting with -1
    ... 8 more
r58Playz commented 2 years ago

The closest update that fixes color inversion, which works on ManyMC, is from 1.5.2 to 13w23b. The snapshots from 13w17a to 13w22a crash with:

Failed to start Minecraft:
java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
  at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
  at org.multimc.EntryPoint.listen(EntryPoint.java:143)
  at org.multimc.EntryPoint.main(EntryPoint.java:34)
Caused by: joptsimple.UnrecognizedOptionException: 'width' is not a recognized option
  at joptsimple.OptionException.unrecognizedOption(OptionException.java:89)
  at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:445)
  at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:54)
  at joptsimple.OptionParser.parse(OptionParser.java:385)
  at net.minecraft.client.main.Main.main(SourceFile:35)
Exiting with -1
  ... 8 more

I was fooling around with the game window settings in a 13w17a instance and I checked a box called Start Maximized. This fixed the error you are talking about.

13w17a doesn't have color inversion.

Screen Shot 2022-03-19 at 2 54 37 PM

Logs (just in case):

ManyMC version: 0.0.7-custom

Launched instance in online mode

authserver.mojang.com resolves to:
    [13.35.123.37]

session.minecraft.net resolves to:
    [3.224.239.34, 52.205.99.166, 3.211.39.224]

textures.minecraft.net resolves to:
    [13.35.122.14, 13.35.122.119, 13.35.122.53, 13.35.122.101]

api.mojang.com resolves to:
    [108.139.2.89]

Minecraft folder is:
/Users/****/Library/Application Support/ManyMC/instances/13w17a/.minecraft

Java path is:
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home/bin/java

Checking Java version...
Java is version 1.8.0_275, using aarch64 architecture, from Azul Systems, Inc..

Main Class:
  net.minecraft.client.main.Main

Native path:
  /Users/****/Library/Application Support/ManyMC/instances/13w17a/natives

Libraries:
  /Users/****/Library/Application Support/ManyMC/libraries/com/mojang/text2speech/1.11.3/text2speech-1.11.3.jar
  /Users/****/Library/Application Support/ManyMC/libraries/ca/weblite/java-objc-bridge/1.1.0-mmachina.1/java-objc-bridge-1.1.0-mmachina.1.jar
  /Users/****/Library/Application Support/ManyMC/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar
  /Users/****/Library/Application Support/ManyMC/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar
  /Users/****/Library/Application Support/ManyMC/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar
  /Users/****/Library/Application Support/ManyMC/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar
  /Users/****/Library/Application Support/ManyMC/libraries/net/sf/jopt-simple/jopt-simple/4.4/jopt-simple-4.4.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar
  /Users/****/Library/Application Support/ManyMC/libraries/argo/argo/2.25_fixed/argo-2.25_fixed.jar
  /Users/****/Library/Application Support/ManyMC/libraries/org/bouncycastle/bcprov-jdk15on/1.47/bcprov-jdk15on-1.47.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/google/guava/guava/14.0/guava-14.0.jar
  /Users/****/Library/Application Support/ManyMC/libraries/org/apache/commons/commons-lang3/3.1/commons-lang3-3.1.jar
  /Users/****/Library/Application Support/ManyMC/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar
  /Users/****/Library/Application Support/ManyMC/libraries/com/mojang/minecraft/13w17a/minecraft-13w17a-client.jar

Native libraries:
  /Users/****/Library/Application Support/ManyMC/libraries/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar
  /Users/****/Library/Application Support/ManyMC/libraries/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209-mmachina.2/lwjgl-platform-2.9.4-nightly-20150209-mmachina.2-natives-osx.jar

Params:
  --username  --session  --workDir /Users/****/Library/Application Support/ManyMC/instances/13w17a/.minecraft

Window size: max (if available)

Java Arguments:
[-Xdock:icon=icon.png, -Xdock:name="ManyMC: 13w17a", -Xms6144m, -Xmx6144m, -Duser.language=en]

Minecraft process ID: 79807

Using onesix launcher.

249 recipes
27 achievements
2022-03-19 14:54:32 [CLIENT] [INFO] Setting user: world_dat
2022-03-19 14:54:32 [CLIENT] [INFO] (Session ID is token:<ACCESS TOKEN>:<PROFILE ID>)
2022-03-19 14:54:32 [CLIENT] [INFO] LWJGL Version: 2.9.4
javax.imageio.IIOException: Can't read input file!
    at javax.imageio.ImageIO.read(ImageIO.java:1302)
    at ask.b(SourceFile:330)
    at ask.K(SourceFile:226)
    at ask.c(SourceFile:511)
    at net.minecraft.client.main.Main.main(SourceFile:78)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)
Warning: the fonts "Times" and "Lucida Bright" are not available for the Java logical font "Serif", which may have unexpected appearance or behavior. Re-enable the "Times" font to remove this warning.

Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.

2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/lava_flow.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/water_flow.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_0.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/fire_1.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/lava.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/portal.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/blocks/water.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/items/clock.txt
2022-03-19 14:54:33 [CLIENT] [INFO] Found animation info for: textures/items/compass.txt
Clipboard copy at: 19 Mar 2022 14:55:29 -0700
r58Playz commented 2 years ago

~~I think that ManyMC/MultiMC's applet wrapper is the issue. 1.5.2 uses the applet wrapper and there is color inversion. 13w17a does not use the applet wrapper and the color inversion is gone.~~

EDIT: MC 1.5.2 without the applet wrapper still has color inversion. Edit 2: A LWJGL 2 applet has color inversion. Also, the newest version before MC 1.5.2 that does not have color inversion is rd-161348.

MoustacheOff commented 2 years ago

The same problem occurs when using VulkanMod when taking a screenshot ("F2" key --> screenshots managed by Minecraft) VulkanMod

These issues might be related.

cocona20xx commented 2 years ago

The current understanding I have is that the vanilla version of the bug is, to some extent, related to the usage of the java.awt.Canvas class and subclasses derived from it, which have been depricated for quite a while (see https://github.com/betacraftuk/legacyfix/blob/ecd2e9e6cb173ef8e4211dd697895649be0e1344/src/legacyfix/agent/LegacyFixAgent.java which uses ASM to patch out any usage of classes from the java.awt package, leading to somewhat better performance and no inverted color issues on Apple SIlicon).

This probably isn't within the scope of ManyMC as a result, as it's an issue with minecraft's codebase itself (and applying the de-awt patches from ManyMC may break compatibility with some mods). It's probably best for projects like Legacy Fabric and Cursed Fabric, or mods for older versions themselves (such as Better than Wolves Community Edition, which I'm an occasional contributor to due to this very issue) to fix this themselves.

It might work to allow users on versions old enough to have this issue to enable the relevant patches from ManyMC as an off by default instance option, perhaps? This would ensure that the patches aren't applied when they aren't needed.

cocona20xx commented 2 years ago

Over a month late, but yeah the above is basically confirmed—all bugs except for crash on manual window resizing are fixed by 'de-AWT'ing the game. This is probably outside of ManyMC's scope honestly, and should be done by mods/modloaders.