Skip to content

Instantly share code, notes, and snippets.

@TimOverboard
Forked from Coderlane/copy_lwjgl.sh
Last active November 10, 2016 22:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimOverboard/ce0c9cf7434f42d4e0d2e25a562346f3 to your computer and use it in GitHub Desktop.
Save TimOverboard/ce0c9cf7434f42d4e0d2e25a562346f3 to your computer and use it in GitHub Desktop.
Updated for Minecraft 1.10 - Minecraft lwgjl native runtime libs hack.
#! /bin/bash
#
# -SCOPE
# This script will replace the shared library files lwjgl.so and libopenal.so
# contained in the minecraft lwjgl *natives-linux.jar with those in a specified
# directory and update the associated sha1sum.
# The purpose of this is to enable playing of "standard" minecraft
# on non x86 / i386 chipsets running linux. Eg. ARM.
#
# -IMPORTANT
# Vanilla minecraft version 1.10 / launcher 1.6.61 downloads and overwrites
# the *natives-linux.jar upon every launch, so this method does not work.
# I do not know what MC version introduced the overwriting.
# -HOWEVER...
# This hack still works if an appropriate modded version of minectraft is used.
# For example, the OptiFine mod (which improves performance anyway)
# will not overwrite said *natives-linux.jar files providing the hash is fine.
#
# This method has not been checked with any other mods, but it seems
# a good bet that CONTINUAL OVERWRITING OF RUNTIME LIBS will not be the norm -
# unless the modding community has developed a taste for shitty,
# SSD-trashing code (like mojang).
# (a bit dramatic, I know.. but it's irritating this hack has to exist)
#
# -USAGE
# copy-lwjgl.sh [ PATH/TO/YOUR/NATIVE/LIBS ] [ MC-lwjgl-build-version ]
#
# Arguments are optional.
#
# The default values supplied in this script align with
# a default minecraft 1.10 'installation' (using ~/.minecraft) and
# Roger Allen's original instructional on compiling liblwjgl and libopenal
# for the Jetson TK1 which can be found at:
#
# https://rogerallen.github.io/jetson/2014/07/31/minecraft-on-jetson-tk1/
#
# -NOTES
# If your minecraft dir is not ~/.minecraft, you will need to hack this script.
#
# -NOT IRRITATING
# Minecraft with OptiFine on the Jetson TK1. It's surprisingly awesome and
# stable (so far). Really glad I didn't buy an ODROID.
#
# -NEED MOAR HELP? I MAK BUG?
# I don't care.
if [ -z "$1" ]; then
MINECRAFT_NATIVE_PATH=~/Minecraft/Natives
# Default directory for custom native shared libs liblwjgl.so & libopenal.so
else
MINECRAFT_NATIVE_PATH=$1
fi
if [ -z "$2" ]; then
NATIVES_BUILD="2.9.4-nightly-20150209"
# Correct as of 1.10.2
else
NATIVES_BUILD=$2
fi
MINECRAFT_LWJGL_PATH=~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl-platform/$NATIVES_BUILD
zip -j "$MINECRAFT_LWJGL_PATH/lwjgl-platform-$NATIVES_BUILD-natives-linux.jar" \
"$MINECRAFT_NATIVE_PATH/liblwjgl.so" \
"$MINECRAFT_NATIVE_PATH/libopenal.so"
SHA1_SUM=$(sha1sum "$MINECRAFT_LWJGL_PATH/lwjgl-platform-$NATIVES_BUILD-natives-linux.jar" --tag | awk '{print $4}')
echo "New sha1sum: $SHA1_SUM"
echo $SHA1_SUM > "$MINECRAFT_LWJGL_PATH/lwjgl-platform-$NATIVES_BUILD-natives-linux.jar.sha"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment