Last active
January 31, 2023 06:57
-
-
Save velnias75/f7a6e44b1dc114a95264fcb47dc35fed to your computer and use it in GitHub Desktop.
Transparent fabric mod folder version switcher for Minecraft
This file contains hidden or 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 | |
export DRI_PRIME=1 | |
export vblank_mode=0 | |
$DROPCACHES="$HOME/bin/drop_caches.sh" | |
if [ -x $DROPCACHES ]; | |
then | |
sync | |
sudo $DROPCACHES | |
fi | |
sudo cpufreq-set -c 0 -g schedutil | |
sudo cpufreq-set -c 1 -g schedutil | |
OPWD=`pwd` | |
CMD="$@" | |
if [[ "$CMD" == *"JavaCheck.jar"* ]] | |
then | |
exit 1 | |
fi | |
GAMEDIR=`echo $CMD | grep -o "\\-\\-gameDir [^ ]*" | sed 's/--gameDir //'` | |
cd $GAMEDIR | |
FABVER=`echo $CMD | grep -o "\\-\\-version fabric\-loader\-\([0-9\\.\\-]\)*"` | |
if [[ $FABVER =~ \-\-version\ fabric\-loader\-([0-9\.]+)\-([0-9\.]+) ]] | |
then | |
MCVER="${BASH_REMATCH[2]}" | |
fi | |
case $MCVER in | |
"1.16.5") | |
JVM="/opt/graalvm-ce-java11-21.1.0/bin/java" | |
JOPTS="" | |
;; | |
*) | |
JVM="/opt/graalvm-ce-java19-22.3.1/bin/java" ; | |
JOPTS="-Djava.net.preferIPv6Addresses=true -XX:+EnableJVMCI -XX:+UseJVMCICompiler -Dgraal.LoopRotation=true -Dgraal.PartialUnroll=true -Dgraal.VectorizeSIMD=true -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1" | |
;; | |
esac | |
MODFOLDER="$GAMEDIR/mods.$MCVER" | |
if [ -d "$MODFOLDER" ]; | |
then | |
rm -rf mods | |
ln -s $MODFOLDER "$GAMEDIR/mods" | |
fi | |
cd $OPWD | |
exec obs-glcapture nice -n -16 $JVM "$@" $JOPTS | |
sudo cpufreq-set -c 1 -g ondemand | |
sudo cpufreq-set -c 0 -g ondemand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment