Skip to content

Instantly share code, notes, and snippets.

@Coderlane
Last active December 24, 2019 05:27
Show Gist options
  • Select an option

  • Save Coderlane/079e3b77369a6a1d2b01 to your computer and use it in GitHub Desktop.

Select an option

Save Coderlane/079e3b77369a6a1d2b01 to your computer and use it in GitHub Desktop.
Copy lwjgl binaries into the linux natives jar file for minecraft.
#!/bin/bash
# This script will copy the newly compiled lwjgl.so and libopenal.so
# from the specified directory into the correct minecraft jar file.
# It will then compute and update the correct sha1sum.
#
# First Arguement (Required):
# Path to the directory containing:
# lwjgl.so and libopenal.so
#
# Second Arguement (Optional):
# Path to the directory containing:
# liwjgl-platform-2.9.1-natives-linux.jar and
# liwjgl-platform-2.9.1-natives-linux.jar.sha
#
# Example usage
# copy_lwjgl.sh ~/Minecraft/Natives
# or
# copy_lwjgl.sh ~/Minecraft/Natives ~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl-platform/2.9.1
if [ -z "$1" ]; then
echo "Error, Need at least one arguement."
exit -1
else
MINECRAFT_NATIVE_PATH=$1
fi
if [ -z "$2" ]; then
MINECRAFT_LWJGL_PATH=~/.minecraft/libraries/org/lwjgl/lwjgl/lwjgl-platform/2.9.1
else
MINECRAFT_LWJGL_PATH=$2
fi
zip -j "$MINECRAFT_LWJGL_PATH/lwjgl-platform-2.9.1-natives-linux.jar" \
"$MINECRAFT_NATIVE_PATH/liblwjgl.so" \
"$MINECRAFT_NATIVE_PATH/libopenal.so"
SHA1_SUM=$(sha1sum "$MINECRAFT_LWJGL_PATH/lwjgl-platform-2.9.1-natives-linux.jar" --tag | awk '{print $4}')
echo "New sha1sum: $SHA1_SUM"
echo $SHA1_SUM > "$MINECRAFT_LWJGL_PATH/lwjgl-platform-2.9.1-natives-linux.jar.sha"
@mathuin
Copy link
Copy Markdown

mathuin commented Jul 1, 2015

The platform version has changed. I modified the script to detect the version automatically. It seems to work. I'm getting an exception in libxrandr, though.

@steven-ellis
Copy link
Copy Markdown

I've had to tweak your script for recent installs of minecraft as the target JAR depends on the path

For details see https://github.com/steven-ellis/HP_ARM_Chromebook_Linux/blob/master/Minecraft/bin/copy_lwjgl.sh

@TimOverboard
Copy link
Copy Markdown

I've tweaked this again (barely) to work with minecraft 1.10, with modded caveat.
https://gist.github.com/DrDaymaker/ce0c9cf7434f42d4e0d2e25a562346f3

@Koohiisan
Copy link
Copy Markdown

This was working for me on an ASUS Flip Chromebook in XFCE4 via Crouton, but now it no longer does. I'm on launcher version 1.6.70, which I think updated around the time the 1.11 update came out.

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