Created
October 21, 2017 15:40
-
-
Save cnaude/9bb754d1cc6037279ceec8c7d1ccfd02 to your computer and use it in GitHub Desktop.
Install Optifine into MultiMC instance on Linux workstation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MULTIMCDIR=/home/cnaude/Minecraft/MultiMC | |
if [[ -z "$2" ]]; then | |
echo "** Usage: $0 [Optifine.jar] [instance]" | |
exit 1 | |
fi | |
FILE=$1 | |
if [ ! -e "$FILE" ]; then | |
echo "** Unable to read $FILE" | |
exit 1 | |
fi | |
JARFILE=$(basename $FILE) | |
VERSION=$(echo $JARFILE | sed 's/OptiFine_//g' | sed 's/.jar//g') | |
NEWJAR="OptiFine-${VERSION}.jar" | |
MCVERSION=$(echo $VERSION | sed 's/OptiFine_//g'| sed 's/_.*//g') | |
INSTANCE=$2 | |
INSTANCEDIR=${MULTIMCDIR}/instances/${INSTANCE} | |
PATCHESDIR=${INSTANCEDIR}/patches | |
LWVERSION=1.12 | |
LIBDIR=${MULTIMCDIR}/libraries/optifine/OptiFine/${VERSION} | |
if [[ ! -d $LIBDIR ]]; then | |
mkdir -p $LIBDIR | |
fi | |
cp $FILE $LIBDIR/$NEWJAR | |
if [[ $? -eq 0 ]]; then | |
echo "** Copied ${FILE} to ${LIBDIR}/${NEWJAR}" | |
fi | |
if [[ ! -d $INSTANCEDIR ]]; then | |
echo "** Unable to find ${INSTANCEDIR}" | |
echo 1 | |
fi | |
if [[ ! -d $PATCHESDIR ]]; then | |
mkdir -p $PATCHESDIR | |
fi | |
cat <<JSON > ${INSTANCEDIR}/patches/optifine.json | |
{ | |
"+libraries": [ | |
{ | |
"name": "net.minecraft:launchwrapper:${LWVERSION}" | |
}, | |
{ | |
"name": "optifine:OptiFine:${VERSION}", | |
"MMC-hint": "local" | |
} | |
], | |
"+tweakers": [ "optifine.OptiFineTweaker" ], | |
"fileId": "optifine.OptiFine", | |
"mainClass": "net.minecraft.launchwrapper.Launch", | |
"mcVersion": "${MCVERSION}", | |
"name": "OptiFine", | |
"order": 200, | |
"version": "${VERSION}" | |
} | |
JSON | |
if [ $? -eq 0 ]; then | |
echo "** Created ${INSTANCEDIR}/patches/optifine.json" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
so what do i do with this???