Skip to content

Instantly share code, notes, and snippets.

@crabdancing
Created August 3, 2018 23:43
Show Gist options
  • Save crabdancing/7187b87fb7225567c3cdd3042c5c4628 to your computer and use it in GitHub Desktop.
Save crabdancing/7187b87fb7225567c3cdd3042c5c4628 to your computer and use it in GitHub Desktop.
Minecraft Launcher alternative with no bullshit calling home
#!/usr/bin/env bash
# Copyleft (C) Alexandria Pettit
# GNU GPL v3
# This is a script to load Minecraft on Linux machines without using Mojang's crappy launcher.
# It is currently pretty much unusable for anyone but me, but I'm going to hopefully fix that soon!
# it'll require quite a lot of reverse engineering however.
# TODO: figure out how to better dynamicize .jar lib loading
# TODO: figure out if we can get auth tokens ourself, instead of relying on the launcher
# TODO: make it possible to use this script with vanilla Minecraft too
# TODO: make firejail optional
# Contains mc_username, mc_access_token, and mc_uuid
source /etc/minecraft_credentials.conf
# Standard definitions for Minecraft's home directory and libpath.
# These shouldn't need to be changed.
export mcpath="$HOME/.minecraft"
export libpath="$mcpath/libraries"
# Maximum memory available to the JVM
export java_maxmem=8G
# Initial memory Java has allocated.
export java_initmem=3G
export mc_game_version_string="1.12.2-forge1.12.2-14.23.4.2745"
export forge_jar_path="$libpath/net/minecraftforge/forge/1.12.2-14.23.4.2745/forge-1.12.2-14.23.4.2745.jar"
# This normally shows up under .minecraft/libraries/versions/blah/somethingblah-natives,
# but it's necessary to copy that out after the launcher has generated the file.
# Otherwise, the launcher will stupidly delete it after it exits. Yeah, screw you too Mojang.
export nativelibs_path="$mcpath/nativelibs"
# We use firejail because paranoia is good
firejail --profile=/etc/firejail/minecraft.profile \
/usr/lib/jvm/java-8-openjdk/jre/bin/java -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:\
-UseAdaptiveSizePolicy -Xmn128M -Xmx"$java_maxmem" -Xms"$java_initmem" \
-Djava.library.path="$nativelibs_path" \
-Dminecraft.launcher.brand=java-minecraft-launcher \
-Dminecraft.launcher.version=1.6.89-j \
-Dminecraft.client.jar=/home/a/.minecraft/versions/1.12.2/1.12.2.jar \
-cp "$forge_jar_path":\
"$libpath"/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar:\
"$libpath"/org/ow2/asm/asm-all/5.2/asm-all-5.2.jar:\
"$libpath"/org/jline/jline/3.5.1/jline-3.5.1.jar:\
"$libpath"/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar:\
"$libpath"/com/typesafe/akka/akka-actor_2.11/2.3.3/akka-actor_2.11-2.3.3.jar:\
"$libpath"/com/typesafe/config/1.2.1/config-1.2.1.jar:\
"$libpath"/org/scala-lang/scala-actors-migration_2.11/1.1.0/scala-actors-migration_2.11-1.1.0.jar:\
"$libpath"/org/scala-lang/scala-compiler/2.11.1/scala-compiler-2.11.1.jar:\
"$libpath"/org/scala-lang/plugins/scala-continuations-library_2.11/1.0.2/scala-continuations-library_2.11-1.0.2.jar:\
"$libpath"/org/scala-lang/plugins/scala-continuations-plugin_2.11.1/1.0.2/scala-continuations-plugin_2.11.1-1.0.2.jar:\
"$libpath"/org/scala-lang/scala-library/2.11.1/scala-library-2.11.1.jar:\
"$libpath"/org/scala-lang/scala-parser-combinators_2.11/1.0.1/scala-parser-combinators_2.11-1.0.1.jar:\
"$libpath"/org/scala-lang/scala-reflect/2.11.1/scala-reflect-2.11.1.jar:\
"$libpath"/org/scala-lang/scala-swing_2.11/1.0.1/scala-swing_2.11-1.0.1.jar:\
"$libpath"/org/scala-lang/scala-xml_2.11/1.0.2/scala-xml_2.11-1.0.2.jar:\
"$libpath"/lzma/lzma/0.0.1/lzma-0.0.1.jar:\
"$libpath"/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar:\
"$libpath"/java3d/vecmath/1.5.2/vecmath-1.5.2.jar:\
"$libpath"/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar:\
"$libpath"/org/apache/maven/maven-artifact/3.5.3/maven-artifact-3.5.3.jar:\
"$libpath"/com/mojang/patchy/1.1/patchy-1.1.jar:\
"$libpath"/oshi-project/oshi-core/1.1/oshi-core-1.1.jar:\
"$libpath"/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar:\
"$libpath"/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:\
"$libpath"/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:\
"$libpath"/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar:\
"$libpath"/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:\
"$libpath"/com/paulscode/codecwav/20101023/codecwav-20101023.jar:\
"$libpath"/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:\
"$libpath"/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:\
"$libpath"/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:\
"$libpath"/io/netty/netty-all/4.1.9.Final/netty-all-4.1.9.Final.jar:\
"$libpath"/com/google/guava/guava/21.0/guava-21.0.jar:\
"$libpath"/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar:\
"$libpath"/commons-io/commons-io/2.5/commons-io-2.5.jar:\
"$libpath"/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:\
"$libpath"/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:\
"$libpath"/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:\
"$libpath"/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:\
"$libpath"/com/mojang/authlib/1.5.25/authlib-1.5.25.jar:\
"$libpath"/com/mojang/realms/1.10.22/realms-1.10.22.jar:\
"$libpath"/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:\
"$libpath"/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:\
"$libpath"/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:\
"$libpath"/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:\
"$libpath"/it/unimi/dsi/fastutil/7.1.0/fastutil-7.1.0.jar:\
"$libpath"/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar:\
"$libpath"/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar:\
"$libpath"/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar:\
"$libpath"/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar:\
"$libpath"/com/mojang/text2speech/1.10.3/text2speech-1.10.3.jar:\
"$mcpath"/versions/1.12.2/1.12.2.jar net.minecraft.launchwrapper.Launch \
--username "$mc_username" \
--version "$mc_game_version_string" \
--gameDir "$mcpath" \
--assetsDir /home/a/.minecraft/assets \
--assetIndex 1.12 \
--uuid "$mc_uuid" \
--accessToken "$mc_access_token" \
--userType legacy \
--tweakClass net.minecraftforge.fml.common.launcher.FMLTweaker \
--versionType Forge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment