Minecraft: Difference between revisions

From NixOS Wiki
Eljamm (talk | contribs)
→‎Troubleshooting: Add ATlauncher instructions for choosing the correct jre
BENDI (talk | contribs)
m Updated the java compatibility table with versions 1.20.5+ https://minecraft.wiki/w/Java_Edition_1.20.5#cite_note-2
(2 intermediate revisions by 2 users not shown)
Line 21: Line 21:
   pkgs.<LAUNCHER>
   pkgs.<LAUNCHER>
];
];
</syntaxhighlight>Alternatively, the package can be installed per-user with <code>users.users.<USER>.packages</code> or [[home-manager]]. For nix native, use:<syntaxhighlight lang="nix">
</syntaxhighlight>Alternatively, the package can be installed per-user with <code>users.users.<USER>.packages</code> or [[Home Manager|home-manager]]. For nix native, use:<syntaxhighlight lang="nix">
users.users.<USER>.packages = [
users.users.<USER>.packages = [
   pkgs.<LAUNCHER>
   pkgs.<LAUNCHER>
Line 27: Line 27:
</syntaxhighlight>
</syntaxhighlight>


For [[home-manager]], use:<syntaxhighlight lang="nix">
For [[Home Manager|home-manager]], use:<syntaxhighlight lang="nix">
home.packages = [
home.packages = [
   pkgs.<LAUNCHER>
   pkgs.<LAUNCHER>
Line 38: Line 38:
By default, ATlauncher installs its own Java runtime in <code>**USERSDIR**/runtimes/minecraft</code>, which gets selected in the settings' <code>Java Path</code>.
By default, ATlauncher installs its own Java runtime in <code>**USERSDIR**/runtimes/minecraft</code>, which gets selected in the settings' <code>Java Path</code>.


To fix this, make sure to select the java version installed in the system store from the <code>Settings > Java/Minecraft > Java Path</code> menu and also disable the <code>Use Java Provided By Minecraft?</code>.
To fix this, make sure to select the java version installed in the system store from the <code>Settings > Java/Minecraft > Java Path</code> menu and also disable the <code>Use Java Provided By Minecraft?</code> option.


If your instance still doesn't start, check the instance settings and apply the same changes there.
If your instance still doesn't start, check the instance settings and apply the same changes there.
Line 60: Line 60:
|>= 1.18
|>= 1.18
|17
|17
|-
|>= 1.20.5
|21
|}
|}



Revision as of 19:07, 29 July 2024

Minecraft is a sandbox game about building, surviving, fighting, and being creative, developed by Mojang Studios.[1] Minecraft currently has two supported variants known as:

  • Minecraft: Java Edition is only available on Windows, MacOS and Linux and is known for modding.
  • Minecraft: Bedrock Edition is available on Windows, Xbox One, Xbox Series S and X, PlayStation 4 and 5, Nintendo Switch, Android, iOS. Bedrock is not playable on Linux due to UWP applications not being supported on Linux.[2][3]

Launchers

Offical Minecraft Launcher: WebsitePackage/pkgs.minecraft

Warning: 1.19 or higher is not working on NixOS, using alternative clients is strongly recommended.

Prismlauncher: A free, open source launcher. WebsitePackage/pkgs.prismlauncher

ATLauncher: A simple and easy to use Minecraft launcher which contains many different modpacks for you to choose from and play. WebsitePackage/pkgs.atlauncher

Badlion Client: A closed source PvP Modpack. WebsitePackage/pkgs.badlion-client

Lunar Client: A free Minecraft client with mods, cosmetics, and performance boost. WebsitePackage/pkgs.lunar-client

hmcl: A Minecraft Launcher which is multi-functional, cross-platform and popular. WebsitePackage/pkgs.hmcl

Installation

Your preferred client can be either imperatively installed by typing nix-env -iA nixos.<LAUNCHER> or nix profile install nixpkgs#<LAUNCHER> if Flakes are enabled. Preferably, install the package declaratively and globally by typing

environment.systemPackages = [
  pkgs.<LAUNCHER>
];

Alternatively, the package can be installed per-user with users.users.<USER>.packages or home-manager. For nix native, use:

users.users.<USER>.packages = [
  pkgs.<LAUNCHER>
];

For home-manager, use:

home.packages = [
  pkgs.<LAUNCHER>
];

Troubleshooting

ATlauncher can't start instance

By default, ATlauncher installs its own Java runtime in **USERSDIR**/runtimes/minecraft, which gets selected in the settings' Java Path.

To fix this, make sure to select the java version installed in the system store from the Settings > Java/Minecraft > Java Path menu and also disable the Use Java Provided By Minecraft? option.

If your instance still doesn't start, check the instance settings and apply the same changes there.

Prismlauncher doesn't have Java Version XX.

The Prismlauncher package can be overridden with (pkgs.prismlauncher.override { jdks = [ pkgs.<JAVA_PACKAGE> ]; }). For example: (pkgs.prismlauncher.override { jdks = [ pkgs.temurin-bin-21 pkgs.temurin-bin-8 pkgs.temurin-bin-17 ]; })

Minecraft can’t start without Java Version XX.

Different Minecraft versions need different Java versions

Minecraft Version Minimum Compatible JRE Version
< 1.17 8
1.17 16
>= 1.18 17
>= 1.20.5 21

Official Minecraft Launcher fails to start the game.

It is possible that you are attempting to start a version of Minecraft that is 1.19 or higher. Unfortunately, this is broken on NixOS. It is strongly recommended to use alternative launchers.