#!/bin/bash

set -x

# Link project to $HOME/.minecraft.
ln -snf \
	"$(readlink -f "$(dirname "$0")/$(basename "$0" .sh)")" \
	"$HOME/.minecraft"
cd "$HOME/.minecraft" || exit

# Pass over to Minecraft Launcher.
if [ -s "minecraft-launcher.sh" ]; then
	exec /bin/sh minecraft-launcher.sh "$@"
fi
if [ -s "launcher.jar" ]; then
	exec java -jar launcher.jar "$@"
fi
echo "ERROR: Can't locate launcher in $HOME/.minecraft!" >&2
exit 1
