20220518 Minecraft
This article contains some handy tips and tricks around running Minecraft clients and servers, particularly in Linux
Client
Installing Java for client
Linux
-
Download the openjdk jre
# debian-based ☯ ~ sudo apt install default-jre default-jre-headless # arch-based ☯ ~ sudo pacman -S jre-openjdk jre-openjdk-headless -
Make sure
$JAVA_HOMEis set in your environment
For linux, this can be set in your /etc/environment file
☯ ~ echo "/usr/lib/jvm/java-17-openjdk-amd64/" | sudo tee -a /etc/environment
If you installed the openjdk jre, you should be able to find your $JAVA_HOME
with this command
☯ ~ find /usr/lib/jvm/ -iname java-1?-openjdk | sort | tail -1
/usr/lib/jvm/java-17-openjdk-amd64
You can combine the two commands to make this fully automatic, but it’s usually good to check things as you go when doing for the first time
echo $(find /usr/lib/jvm/ -iname java-1?-openjdk | sort | tail -1) | sudo tee -a /etc/environment
M1 OSX
-
Download the openjdk jre
# m1 osx ☯ ~ arch -arm64 brew install openjdk -
Set up Java in your environment
This command comes from the output of the homebrew install, and seems to be needed to make minecraft work
# For the system Java wrappers to find this JDK, symlink it with ☯ ~ sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdkMake sure that the openjdk bin directory is in your
$PATH
You may use .zshrc/.bashrc or whatever else in place of the .bash_profile if you prefer☯ ~ echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> $HOME/.bash_profile
Locations
$HOME/.minecraft/shaderpacks/1.18.2/
$HOME/.minecraft/mods/--
Mods & Shaders
There isn’t a way to fully automate the download of mods & shaders, as curseforge.com the site that normally hosts the files doesn’t host files at static URLS.
One bit of advice would be - for each major version of the minecraft client that you use, download all of the jars and store them in a “backup” location that you can use later if needed.
Mods - Recommendations
These links will trigger the “latest” download for each tool
The Fabric API is a tool that loads mods for your minecraft client. This means that you’ll need to use “fabric” mods if you look into installing others
Generic install link pages
- Fabric Loader
- Litematica (creates/loads schematic overlays)
- MaLiLib (dependency of Litematica)
- MiniHUD (customise the F3 screen)
- Tweakeroo (item placement)
- Starlight (light engine optimisations)
- OptiFabric (allows you to run OptiFine & Fabric together)
Latest install links (1.19.2)
- Fabric Loader
- Litematica (creates/loads schematic overlays)
- MaLiLib (dependency of Litematica)
- MiniHUD (customise the F3 screen)
-
Tweakeroo (item placement)
- Starlight (light engine optimisations)
- OptiFabric (allows you to run OptiFine & Fabric together)
If you want to get fancy, you can use your browser to download these all simultaneously
- replace firefox with your browser if you need
- add/remove links as you like
- paste all lines into your terminal and hit enter!
firefox https://maven.fabricmc.net/net/fabricmc/fabric-installer/0.11.0/fabric-installer-0.11.0.jar &
firefox https://www.curseforge.com/minecraft/mc-mods/fabric-api/download/3921681 &
firefox https://www.curseforge.com/minecraft/mc-mods/litematica/download &
firefox https://www.curseforge.com/minecraft/mc-mods/malilib/download &
firefox https://www.curseforge.com/minecraft/mc-mods/minihud/download &
firefox https://www.curseforge.com/minecraft/mc-mods/tweakeroo/download &
firefox https://www.curseforge.com/minecraft/mc-mods/starlight/download &
firefox https://www.curseforge.com/minecraft/mc-mods/optifabric/download &
wait
Mods - Installation
-
Move all of the jars into your mods folder
cd $HOME/Downloads mv -v \ fabric-api*jar litematica*jar malilib*jar minihud*jar tweakeroo*jar starlight*jar optifabric*jar \ $HOME/.minecraft/mods -
Install fabric API
cd $HOME/Downloads java -jar fabric-installer-*.jar -
If you have optifine, you can install that too using java
cd $HOME/Downloads java -jar preview_OptiFine_1.19_HD_U_H8_pre1.jar
Notes
- In order for OptiFabric to work, you’ll need to move the optifine jar file to
~/.minecraft/modsafter installing it. This isn’t usually required for optifine to work, but is required by OptiFabric
Recommendations - Shaders
Server
Docker
use itzg/minecraft-server
Using this awesome docker image, you can specify the VERSION of your server, and also optionally use FABRIC for installing server-side datapacks/mods
docker pull itzg/minecraft-server:latest
docker run \
-d \
--name mc \
--restart=unless-stopped \
-p 25565:25565 \
-P 25575:25575 \
-e VERSION=1.19 \
-e TYPE=FABRIC \
-e EULA=TRUE \
-v $HOME/.minecraft-server/:/data \
itzg/minecraft-server:latest
mcrcon
mcrcon is a cli tool that you can use for admin control over your server
Install using:
git clone https://github.com/Tiiffi/mcrcon.git
cd mcrcon
make
sudo make install
You can then connect a mcrcon session using these parameters:
0.0.0.0for the hostname of the docker container25575as the mcrcon portminecraftas the default server password
☯ ~ mcrcon -H 0.0.0.0 -P 25575 -p minecraft
Logged in. Type 'quit' or 'exit' to quit.
>worldborder get
The world border is currently 59999968 blocks wide
Finding the world seed
via the Docker server
You can use mcrcon, just add your command that you want to run after you’ve specified your host/port/password
☯ ~ mcrcon -H 0.0.0.0 -P 25575 -p minecraft seed
Seed: [-2679236495807353480]