Skip to content

Instantly share code, notes, and snippets.

@rogerallen
Last active February 21, 2021 23:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save rogerallen/91526c9c8be1a82881e0 to your computer and use it in GitHub Desktop.
Save rogerallen/91526c9c8be1a82881e0 to your computer and use it in GitHub Desktop.
NVIDIA Jetson/ChrUbuntu TK1 Minecraft Commandline
#!/bin/sh
#
# script to run minecraft on ARM linux. for reference:
#
# http://rogerallen.github.io/jetson/2014/07/31/minecraft-on-jetson-tk1/
# https://devtalk.nvidia.com/default/topic/764821/embedded-systems/minecraft-on-the-jetson-tk1/
# https://gist.github.com/rogerallen/91526c9c8be1a82881e0
#
# !!! YOU MUST PERSONALIZE ALL OF THIS INFO !!!
# your personal login/password. chmod 700 to keep this private
MINECRAFT_LOGIN=vvv
MINECRAFT_USERNAME=xxx
MINECRAFT_PASSWORD=yyy
# where did you store the native liblwjgl.so and libopenal.so?
MINECRAFT_NATIVE_PATH=~/Minecraft/Natives
# info from initial run data in .minecraft/launcher_profiles.json
MINECRAFT_CLIENTTOKEN=12345678-1234-1234-1234-123456789abc
MINECRAFT_UUID=12345678-1234-1234-1234-123456789abc
MINECRAFT_VERSION=1.8
# SHOULD NOT NEED TO EDIT BELOW THIS LINE
# long list of paths from the minecraft logged commandline
CP=~/.minecraft/libraries/java3d/vecmath/1.5.2/vecmath-1.5.2.jar:~/.minecraft/libraries/net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar:~/.minecraft/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:~/.minecraft/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:~/.minecraft/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:~/.minecraft/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:~/.minecraft/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:~/.minecraft/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:~/.minecraft/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:~/.minecraft/libraries/io/netty/netty-all/4.0.15.Final/netty-all-4.0.15.Final.jar:~/.minecraft/libraries/com/google/guava/guava/17.0/guava-17.0.jar:~/.minecraft/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:~/.minecraft/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar:~/.minecraft/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:~/.minecraft/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:~/.minecraft/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:~/.minecraft/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar:~/.minecraft/libraries/com/mojang/authlib/1.5.17/authlib-1.5.17.jar:~/.minecraft/libraries/com/mojang/realms/1.5.7/realms-1.5.7.jar:~/.minecraft/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:~/.minecraft/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:~/.minecraft/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:~/.minecraft/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:~/.minecraft/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar:~/.minecraft/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar:~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar:~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar:~/.minecraft/libraries/tv/twitch/twitch/6.5/twitch-6.5.jar:~/.minecraft/versions/1.8/1.8.jar
# thanks to xRoyx on the nvidia dev forums for this update.
# the authtoken changes daily, so we need to login to authenticate
MINECRAFT_ATOKEN="$(\
curl -i \
-H "Accept:application/json" \
-H "content-Type:application/json" \
https://authserver.mojang.com/authenticate \
-X POST \
--data '{"agent": {"name": "Minecraft","version": 1}, "username": "'$MINECRAFT_LOGIN'", "password": "'$MINECRAFT_PASSWORD'", "clientToken": "'$MINECRAFT_CLIENTTOKEN'" }' \
| sed '/accessToken":"/!d;s//&\n/;s/.*\n//;:a;/",/bb;$!{n;ba};:b;s//\n&/;P;D' \
)"
# '
echo "todays access token = "$MINECRAFT_ATOKEN
# run minecraft with all the right commandline options
/usr/lib/jvm/java-7-oracle/jre/bin/java \
-Xmn128M -Xmx512M \
-XX:+UseConcMarkSweepGC \
-XX:+CMSIncrementalMode \
-XX:-UseAdaptiveSizePolicy \
-Djava.library.path=$MINECRAFT_NATIVE_PATH \
-cp $CP \
net.minecraft.client.main.Main \
--username $MINECRAFT_USERNAME \
--accessToken "$MINECRAFT_ATOKEN" \
--uuid "$MINECRAFT_UUID" \
--version $MINECRAFT_VERSION \
--userProperties {} \
--gameDir ~/.minecraft \
--assetsDir ~/.minecraft/assets \
--assetIndex $MINECRAFT_VERSION
@rogerallen
Copy link
Author

@rogerallen
Copy link
Author

For a superior method of how to do this, see:
https://gist.github.com/Coderlane/079e3b77369a6a1d2b01

@YellowOnion
Copy link

Hey, you could try this 3rd party mod that optimises performance especially on multicore systems: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1272953-optifine-hd-b6-fps-boost-dynamic-lights-shaders

@AyHa1810
Copy link

Can you make an updated version of the script for 1.16.3?

@rogerallen
Copy link
Author

Minecraft has made changes that make running on ARM impossible, as far as I can tell. I'll look again if they ever update lwjgl usage to version 3.2.3 (which supports ARM), but don't hold your breath.

@AyHa1810
Copy link

AyHa1810 commented Feb 2, 2021

Also, the auth server got changed. So your code will not work, haha
For new Microsoft auth api, visit this.

@rogerallen
Copy link
Author

Oh joy...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment