Minecraft

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources
Article status
This article has some todo items:
  • Add info about modded clients and servers (Forge, Fabric etc.)
  • Add info about other popular server cores (Paper, Sponge etc.), alternative implementations (Minestom, Glowstone etc.) etc.
  • Add optimizations and tips specifically for Gentoo users

Minecraft is a sandbox game developed by Mojang. The game was developed in Java by creator Markus "Notch" Persson and has been ported to several platforms throughout its development lifecycle. Since the public early alpha release in 2009, the game has sold over 300 million copies making it one of the best selling video games of all time.

Clients

Minecraft can be installed using any number of available launchers. While some launchers can be compiled from source, it is recommended to install the package using Portage as this ensures the correct Java builds are installed and maintained on the system.

Following list includes applications than can launch official Minecraft client implementation. However, there are also exist alternative client implementations. Find a list of these on https://wiki.vg/Client_List.

Official launcher

To install the official Minecraft launcher (games-action/minecraft-launcher), run:

root #emerge --ask games-action/minecraft-launcher

Prism Launcher

Free/libre software launcher for Minecraft with support for multiple instances, managing modpacks and mods etc.

root #emerge --ask games-action/prismlauncher

musl-based system

The official launcher is linked to glibc and is therefore unusable. Prism Launcher can be compiled and run, but it uses the LWJGL binaries provided by Mojang, which are also linked to glibc, making Minecraft non-launchable. As a solution, it is possible to install and run Prism Launcher using Flatpak:

user $flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
user $flatpak install --user flathub org.prismlauncher.PrismLauncher

To run Prism Launcher use the following command (it is important to provide the locale, otherwise Minecraft will not start):

user $flatpak run --env=LC_ALL=en_US.UTF-8 org.prismlauncher.PrismLauncher

Servers

Official server

To install the official Minecraft server (games-server/minecraft-server), run:

root #emerge --ask games-server/minecraft-server

Other servers (PaperMC,Spigot,Bukkit,Sponge,Etc.)

For this example we'll use PaperMC, Although most alternative server software will work in the same way.

Check your Java version

The java versions you'll need are detailed in this table.

Java version table for Minecraft Java Edition
Minecraft Version Java version required
rd-132211 - 1.5.2 Java 5 (1.5.0) or newer
1.6.1 (13w16a) - 1.11.2 (1.12: 17w06a) Java 6 (1.6.0) or newer
1.12 (17w13a) - 1.16.5 (1.17: 21w18a) Java 8 (1.8.0) or newer
1.17 (21w19a) to 1.17.1 (1.18: 1.18 Pre-release 1) Java 16 or newer
1.18 (1.18 Pre-release 2) - 1.20.4 (1.20.5: 24w14potato) Java 17 or newer
1.20.5 (24w14a) - current Java 21 or newer

Download the JAR

This step is pretty self-explanatory.

Simply create a new folder and throw the downloaded JAR there.


user $mkdir mc-server && cd mc-server
user $mv paper-*.jar server.jar

Accept the EULA

Minecraft won't let you run a server without first agreeing with the Minecraft EULA. If you accept the EULA, run the following command to accept it.

user $echo "eula=true" > eula.txt

Run the server

Most of the alternative Minecraft server software are distributed as JAR files; These can be ran very easily with Java installed. Make sure to customize your JVM arguments to both optimize the GC, RAM allocation, Etc. If you don't wish to manually create a list of JVM arguments, check out this website: https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/

user $java <JVM Arguments> -jar server.jar --nogui

Troubleshooting

Minecraft launcher errors

Errors with this package are uncommon, however the following have been noted:

In some instances when executing minecraft-launcher the following output is produced:

user $./minecraft-launcher
[0229/184549.183275:ERROR:sandbox_linux.cc(346)] InitializeSandbox() called with multiple threads in process gpu-process.

This can be resolved by issuing the following options in conjunction with minecraft-launcher:

user $MESA_GLSL_CACHE_DISABLE=true ./minecraft-launcher

Crash in org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes

Older Minecraft versions (which use java 1.8, e.g playing specific modpacks) use LWJGL 2 rather than LWJGL 3. It lacks Wayland support.

If getting a crash like:

java.lang.ExceptionInInitializerError
	at azi.ad(SourceFile:284)
	at azi.f(SourceFile:688)
	at net.minecraft.client.main.Main.main(SourceFile:152)
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at org.lwjgl.opengl.LinuxDisplay.getAvailableDisplayModes(LinuxDisplay.java:951)
	at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:738)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:138)
	... 6 more

or

RuntimeException: No OpenGL context found in the current thread.

try installing x11-apps/xrandr and/or trying an X desktop session.

See also

  • Games — a landing page for many of the games (especially open source variants) available in Gentoo's main ebuild repository.
  • Java — a programming language, originally developed by Sun Microsystems, which uses a platform-independent virtual machine to execute Java bytecode in real-time.
  • Minetest — an infinite-world block sandbox game and game engine that is heavily inspired by Minecraft and InfiniMiner.