#!/bin/sh
echo -ne "\033]2;Minecraft Launcher\007"

# Set username
read -p "What username would you like?: " player

# A minecraft root directory
MC_DIR=~/.minecraft

# Are stored here...
# saves/, resourcepacks/ and screenshots/ dirs
# and options.txt and servers.dat files
GAME_DIR=$MC_DIR

# Assets location
ASSETS_DIR=$MC_DIR/assets
ASSETS_INDEX=1.17

# Version to use
GAME_VERSION=1.17.1

# Native libs location
NATIVES_DIR=$MC_DIR/bin/$GAME_VERSION

# *.jar paths generated by make_libs_list.py
LIBRARIES_LIST=

# Player name
PLAYER_NAME=$player

# Game window resolution
WINDOW_W=800
WINDOW_H=640

# Java machine arguments
JVM_RAM="-Xmx2G"
JVM_ARGS="-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M"

# Running minecraft
cd $MC_DIR

java $JVM_RAM $JVM_ARGS \
-Djava.library.path=$NATIVES_DIR \
-cp $LIBRARIES_LIST \
net.minecraft.client.main.Main \
--username $PLAYER_NAME \
--version $GAME_VERSION \
--accessToken 0 --userProperties {} \
--gameDir $GAME_DIR \
--assetsDir $ASSETS_DIR \
--assetIndex $ASSETS_INDEX \
--width $WINDOW_W --height $WINDOW_H
