Skip to content

Instantly share code, notes, and snippets.

@niksingh710
Created October 6, 2023 04:46
Show Gist options
  • Save niksingh710/474ee536a937f4ab8dfc264491507912 to your computer and use it in GitHub Desktop.
Save niksingh710/474ee536a937f4ab8dfc264491507912 to your computer and use it in GitHub Desktop.
Minecraft java launch.sh
#!/usr/bin/env bash
check() {
command -v "$1" >/dev/null 2>&1
}
notify() {
if check notify-send; then
notify-send "$@"
else
echo "$@"
fi
}
check java || {
notify "Java is not installed"
exit 1
}
_recommended_java="liberica-jdk-17-full"
_current_java="$(archlinux-java get)"
# getting the current launch location of the script
_location="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
sudo archlinux-java set "$_recommended_java"
java \
-Xms4G \
-Xmx4G \
-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 \
-jar "$_location/SKlauncher-3.1.2.jar"
sudo archlinux-java set "$_current_java"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment