dscalzi / helios-core

♾️ A library containing core mechanisms for Helios Launcher
GNU Lesser General Public License v3.0
13 stars 19 forks source link

Unable to select Java in Minecraft 1.21 (Tested on Mac computers with Apple Slicon) #9

Open Uni0305 opened 3 months ago

Uni0305 commented 3 months ago

In macos environment, when using java 17 for Minecraft 1.20.1, java is detected normally, but when trying to use java 21 for Minecraft 1.21, the error "Invalid Selection" is output and there is a problem that cannot be executed.

Minecraft 1.21 with Java 21 Minecraft 1.20.1 with Java 17

I think there was an update from helios-core in this regard, but it still seems to be an issue. https://github.com/dscalzi/helios-core/pull/7

I used the launcher source in almost the same state as the original (modifying distribution url only. last commit: eb683f8), and my distribution.json file is as attached below. (Note: The actual URL was replaced by localhost for security) distribution.json

Uni0305 commented 3 months ago

This same issue also exists in Minecraft 1.12.2 with the Forge mod loader installed, which requires Java 8. However, this issue seems to work normally in the Windows environment, so please check if there is a problem. (Minecraft 1.21, which requires Java 21, still has issues in the Windows environment)

dscalzi commented 3 months ago

These are the default java rules https://github.com/dscalzi/helios-core/blob/master/lib/common/distribution/DistributionFactory.ts#L133

dscalzi commented 3 months ago

You can configure different rules if you need to https://github.com/dscalzi/HeliosLauncher/blob/master/docs/distro.md#javaoptions-object

dscalzi commented 3 months ago

Appears to be an issue with the semver function https://github.com/dscalzi/helios-core/commit/2e3793607bac4dfcb587b27a153f8a4aed5a2942#diff-2de96283ccb9afe0df455134caa33d845a0f5181a4ff12783a48f869552a96adR52

Will stop using that

dscalzi commented 3 months ago

i'll push out a new version in a few days

dscalzi commented 3 months ago

Until that is pushed, you should be able to work around this by just including the following in your severmeta.json in Nebula for your 1.21 server.


{
  "meta": {
    "javaOptions": {
      "supported": ">=21",
      "suggestedMajor": 21
    }
  }
}
wolfun2001 commented 2 months ago

semver.satisfies is also used in JavaGuard, and I think it may not work correctly in certain situations. For example, when my intention is >=8, if I select version 11 of Java, it will return false.

dscalzi commented 3 weeks ago

Is this still an issue?