After quite a bit of encouraging information from Nicholas Bering that it might actually be possible to install Java Minecraft onto the RPi, I absolutely had to give it a go. His post is two years old, and a lot has happened since his post: Microsoft forced all the players to migrate from their Mojang account to new Microsoft accounts (I got a cape out of it), Minecraft moved to Java 17 from MC version 1.17 onwards, and the GL demands have been outside of what is currently supported by Linux. That been said - and to my surprise - it is possible to do this using MultiMC, an application I use a lot already to create different instances of Minecraft for my account, and which supports Fabric and Forge for those who enjoy modding their Minecraft.
Below presumes you have Raspbian already installed on your Raspberry Pi 4 Model B 8G version, and that you can boot to desktop. It must be the ARM 64-bit OS version, or this won't work. These instructions also presume you are using "pi" as the user on your RPi, but if it's something else, it shouldn't be too difficult to figure out where you change the commands. Most of below will be done in the Terminal, which you can bring up on your Desktop.
Preparing to compile your own Minecraft launcherYou will be compiling your own version of MultiMC, currently the only solution which will get you to Minecraft on the RPi. Therefore, install the following:
sudo apt-get install \
build-essential \
cmake \
libqt5core5a
libqt5network5
libqt5gui5
qtbase5-dev \
zlib1g-dev \
libgl1-mesa-dev \
git \
zip
Once you've done this, you're ready to begin the next step.
Install Java 17Minecraft needs Java 17 to run higher versions of the game, so this is an absolute must. From the research I did, the best version of Java 17 out there for the RPi is the one from Temurin, which you can obtain with the installation of SDK, a library of every flavour of Java available.
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 17.0.0-tem
You will be asked if you want to make this the default Java for your device; I said yes, but I don't believe this is mandatory. What I did discover is that the Java 17 is located in a place where MultiMC cannot see it, so I had to make a copy of it in a location where it could.
sudo mkdir /usr/lib/jvm/java17
sudo cp -R /home/pi/.sdkman/candidates/java/current /usr/lib/jvm/java17
This will come in handy when setting up your instance of Minecraft on your fork of MultiMC.
Downloading the source code for MultiMCIn order to make your own fork of MultiMC, you first need their source code, which you can obtain as follows:
cd /home/pi
mkdir ~/MultiMC
cd ~/MultiMC
git clone --recursive https://github.com/MultiMC/Launcher.git src
mkdir build
mkdir install
cd build
At this point, you need to prepare your uncompiled fork so that you can later add a Microsoft account. MultiMC provides very good information as to how this is to be done, but they also ask that you don't try to pass off your compiled version as a genuine MultiMC or Mojang product. I would ask that you respect their request, and rebrand your fork to be unique, naming it something like "Bob's Home Brew MC Launcher" and not using their brands. After all, it is only because of their goodwill and sharing of source code that this can be done. Additionally, don't make a binary out of this and share the binary with others; I believe this violates the terms of use specified by Microsoft, who are also allowing you to set up their official Microsoft authentication solution in your own fork. I also would not recommend to share the uncompiled final version either, as your Microsoft Application ID is in the code, and this could be inappropriately used by others at your own peril.
Obtain a Microsoft Application (Client) IDWarning: you will need a credit card to execute the next steps. There is no charge (you are given a 200 dollar credit by Microsoft for setting up an Azure account), but you cannot continue without providing a valid credit card number. To obtain a Microsoft Application ID, follow the instructions at https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app which effectively require you to:
- register an Azure account
- go to the Azure portal at https://portal.azure.com/
- register a new app (aka your MultiMC fork) under Azure Active Directory
- follow the rules and specifications when setting up the app (unique branding, etc), as defined in https://github.com/MultiMC/Launcher/tree/develop/notsecrets
The app registration should: (1) be only for personal accounts; (2) not have any redirect URI; (3) not have any platform; (4) have no credentials; (5) no certificates; (6) no client secrets; (7) enable 'Live SDK support' for access to XBox APIs; (8) enable 'public client flows' for OAuth2 device flow.
Once you have your ID, you are ready to make some changes to your source code:
sudo cp -R /home/pi/MultiMC/src/notsecrets /home/pi/MultiMC/src/secrets
sudo nano /home/pi/MultiMC/src/secrets/Secrets.cpp
Once in the file, find below and add your ID:
QString MSAClientID = "application client ID goes here";
Ctrl-X, and Y to exit. Then you need to make sure that the compilation includes your Microsoft Application (Client) ID as follows:
sudo nano /home/pi/MultiMC/src/CMakeLists.txt
Find the line below and change the value from "OFF" to "ON":
option(Launcher_EMBED_SECRETS "Determines whether to embed secrets.
Secrets are separate and non-public." ON)
Ctrl-X, and Y to exit. Now you are ready to begin compiling your fork using CMAKE.
Compile your fork of MultiMCThere is one important parameter to embed in your compilation command which pulls in the ARM64 version of LWJGL (Light Weight Java Game Library) version 3. If you don't use these versions of the library, the application will compile, but it won't work. This is a deviation from Nicholas' article, but resolves the errors I was getting using the MultiMC instances I was running post-compilation with his tweak. It took many compilations and different permutations of LWJGL before I found one that did the job.
cmake -DCMAKE_INSTALL_PREFIX=../install \
-DLauncher_META_URL:STRING="https://raw.githubusercontent.com/theofficialgman/meta-multimc/master-clean/index.json" \
../src
Once you have done this, you are ready to compile. This will take some time, so go get a coffee once you start the next command.
make -j4
Once run, you can continue:
make install
You can find an executable called DevLauncher in your /home/pi/MultiMC/install directory. When you run it, it will launch. But you're not fully done yet, as both 1.17 and 1.18 are looking for a newer version of LWJGL which does not exist for Linux at the time of writing this article. The only way around this is to amend the DevLauncher directly.
sudo nano /home/pi/MultiMC/install/DevLauncher
Once in the script, find where all the "export" commands are located, and add one more export command as follows:
export MESA_GL_VERSION_OVERRIDE=4.3
I've also seen some posts where they use 4.5 instead of 4.3, but I used 4.3. Ctrl-X, and Y to exit. Now you're done. This "fools" Minecraft into thinking you are using 4.3. I found a number of posts on Planet Minecraft about this topic, so I don't believe this is an issue isolated to Raspberry Pi's but rather all Linux installations. Nevertheless, at this point, you have a working version of your own MultiMC fork which will run 1.18. You will need to specify the location of Java 17 (/usr/lib/jvm/java17) at the time of set up, and I recommend to specify a minimum/maximum of RAM equal to 2GB/4GB respectively (which is why I recommend using the 8GB version of the Pi).
Add a shortcut to the MultiMC fork (optional)To be elegant, I added the application to my application menu. I chose an icon from the internet using Chromium which I liked and downloaded it to /home/pi/Downloads. In my case, I chose the classic grass block icon: https://www.freeiconspng.com/img/16705
Assuming you choose the same (you don't have to, but then amend the .desktop file you create), just add a shortcut as follows:
sudo nano /usr/share/applications/Minecraft.desktop
Once it is open, paste the following into the file:
[Desktop Entry]
Version=1.1
Type=Application
Encoding=UTF-8
Name=Minecraft
Comment=Personal MultiMC Fork
Icon=/home/pi/Downloads/minecraft-png-icon-16705.png
Exec=/home/pi/MultiMC/install/DevLauncher
Tyape=Application
Terminal=false
Categories=Game
Ctrl-X and Y to save this. I believe this automatically will show up in your menu when you save the .desktop file here.
Add the Microsoft accountIf you followed above correctly, the "Add Microsoft" will not be greyed out when you go to Profiles and choose Manage Accounts. The timeout for the set up of a Microsoft account is very short, so I recommend already having the below website up and running before you click on "Add Microsoft". You will need to enter your email address (the one you use to play Minecraft; this is not your Azure account), password and click to accept your fork's access to your Microsoft account in a very short period of time. I needed four attempts before I got the knack to it and could do it before the window timed out.
https://www.microsoft.com/link
Set up the 1.18.2 instance of MinecraftJust make sure the settings are for Java 17 and the memory requirements are increased to 4GB, and then Launch. After a short period, the usual Mojang splash screen will appear, and then you can set up your own single player world or access the multi-player servers out there. I recommend to set up a single player world first (it will take a while, so be patient), so you can then amend your video settings to the lowest CPU intensive settings until you can smoothly move your avatar around the world you made.
If you have any suggestions on how to improve performance of Minecraft, for example, by overclocking the CPU, I would be very interested. Leave a comment below with your performance enhancing ideas!
Hope you enjoy! I'm already on my favourite multi-player server, noob-friendly.com and the RPi is holding up! What's that? Creeper! Ah man!
Comments
Please log in or sign up to comment.