Fix client-side designation (#32)
* The developer says its client only. * Minor correction to the mod name * Should be client only. * Disable asyncRecipeSearching due to several breaking bugs in the current implementation. * Update hashes * Fix server script to point to the correct pack.toml * Corrected the start.sh server script. Changes: Will try to fallback on wget if curl is not found. Use the -p flag on mkdir so it won't error on already existing directories * Fixed forgotten cURL flag * Added start.ps1 script for Powershell users. It currently differs significantly from start.sh: - It pulls FindMe from modrinth by using their API so as to avoid having to hardcode the location - It will pull in the latest packwiz bootstrap from gh releases to avoid hardcoding the location - It cleans up after itself - It allows the user to accept the MC EULA from within the script itself The 3 variables at the top will need to be updated to match the expected versions every time those are altered. I don't think I'll be able to replicate this functionality in bash as I'm not as familiar but I'm sure someone else will rise to the challenge. * Corrected the modrinth qs for findme
This commit is contained in:
129
serverpack/start.ps1
Normal file
129
serverpack/start.ps1
Normal file
@@ -0,0 +1,129 @@
|
||||
$GAME_VERSION = "1.20.1"
|
||||
$FORGE_VERSION = "1.20.1-47.1.84"
|
||||
$FINDME_VERSION = "3.1.0"
|
||||
|
||||
$PACK_URI = "https://raw.githubusercontent.com/GregTechCEu/GregTech-Modern-Community-Pack/main/pack.toml"
|
||||
|
||||
# Ensure java is installed
|
||||
if (!(Get-Command java)) {
|
||||
Write-Host -ForegroundColor Red "Java 17, which is a requirement for Minecraft, was not detected on this system."
|
||||
Write-Host -ForegroundColor Green "On windows you can install it via the winget windows package manager by running:"
|
||||
Write-Host -ForegroundColor Green "winget install -e --id EclipseAdoptium.Temurin.17.JRE"
|
||||
Write-Host -ForegroundColor Green "On other systems, via your platform's package manager."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Install (Neo)Forge
|
||||
if (!(Test-Path "forge-$FORGE_VERSION-installer.jar")) {
|
||||
|
||||
$FORGE_URI = "https://maven.neoforged.net/releases/net/neoforged/forge/$FORGE_VERSION/forge-$FORGE_VERSION-installer.jar"
|
||||
|
||||
Write-Host -ForegroundColor Yellow "Clearing potentially incorrect versions of NeoForge..."
|
||||
Get-ChildItem -Path ".\" -Filter "forge-*-installer.jar" | Remove-Item | Out-Null
|
||||
|
||||
Write-Host -ForegroundColor Blue "Fetching NeoForge Version $FORGE_VERSION"
|
||||
Invoke-WebRequest -Uri $FORGE_URI -OutFile "forge-$FORGE_VERSION-installer.jar"
|
||||
|
||||
Write-Host -ForegroundColor Blue "Installing NeoForge as server, this will take a few minutes."
|
||||
|
||||
java -jar "forge-$FORGE_VERSION-installer.jar" --installServer 2>&1 | ForEach-Object {
|
||||
Write-Progress -Activity "Installing NeoForge" -Status $_
|
||||
}
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host -ForegroundColor Green "NeoForge installation completed successfully."
|
||||
Write-Progress -Completed -Activity "Removing progress bar."
|
||||
} else {
|
||||
Write-Host -ForegroundColor Red "NeoForge installation failed with exit code $LASTEXITCODE."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor Yellow "Cleaning up..."
|
||||
Remove-Item "run.sh", "run.bat" -Force
|
||||
}
|
||||
|
||||
# FindMe does not allow distribution on curseforge
|
||||
if (!(Test-Path "mods\findme-$FINDME_VERSION-forge.jar")) {
|
||||
|
||||
$FINDME_ID = "rEuzehyH"
|
||||
$FINDME_QUERY = @{
|
||||
"game_versions" = "[`"$GAME_VERSION`"]"
|
||||
loaders = '["forge"]'
|
||||
}
|
||||
|
||||
$FINDME_DATA = Invoke-WebRequest `
|
||||
-Uri "https://api.modrinth.com/v2/project/$FINDME_ID/version" `
|
||||
-Body $FINDME_QUERY `
|
||||
| ConvertFrom-Json `
|
||||
| Where-Object { ($_.version_number.toString() -eq $FINDME_VERSION) -and $_.files.primary }
|
||||
|
||||
$FINDME_URI = $FINDME_DATA.files | Select-Object -first 1 -ExpandProperty url
|
||||
|
||||
Write-Host -ForegroundColor Yellow "Clearing potentially incorrect versions of the FindMe mod..."
|
||||
if (Test-Path ".\mods") {
|
||||
Get-ChildItem -Path ".\mods" -Filter "findme-*-forge.jar" | Remove-Item | Out-Null
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor Blue "Fetching the FindMe mod..."
|
||||
New-Item -ItemType Directory -Path mods -Force | Out-Null
|
||||
Invoke-WebRequest -Uri $FINDME_URI -OutFile "mods"
|
||||
}
|
||||
|
||||
# Install packwiz-installer-bootstrap if needed.
|
||||
if (!(Test-Path "packwiz-installer-bootstrap.jar")) {
|
||||
|
||||
Write-Host -ForegroundColor Yellow "Finding the latest packwiz-installer-bootstrap release..."
|
||||
$BOOTSTRAP_RELEASES = "https://api.github.com/repos/packwiz/packwiz-installer-bootstrap/releases/latest"
|
||||
$BOOTSTRAP_URI = Invoke-WebRequest $BOOTSTRAP_RELEASES `
|
||||
| ConvertFrom-Json `
|
||||
| Select-Object -Property assets `
|
||||
| ForEach-Object { $_.assets.browser_download_url } `
|
||||
| Select-Object -first 1
|
||||
|
||||
Write-Host -ForegroundColor Blue "Fetching the packwiz-installer-bootstrap..."
|
||||
Invoke-WebRequest -Uri $BOOTSTRAP_URI -OutFile "packwiz-installer-bootstrap.jar"
|
||||
|
||||
}
|
||||
|
||||
# Use packwiz-installer-bootstrap to generate or update the modpack.
|
||||
Write-Host -ForegroundColor Magenta "Updating the server pack..."
|
||||
java -jar "packwiz-installer-bootstrap.jar" -g -s server $PACK_URI 2>&1 | ForEach-Object {
|
||||
Write-Progress -Activity "Installing mods and related files" -Status $_
|
||||
}
|
||||
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host -ForegroundColor Green "Server installation/update complete."
|
||||
Write-Progress -Completed -Activity "Removing progress bar."
|
||||
} else {
|
||||
Write-Host -ForegroundColor Red "Server installation/update failed with exit code $LASTEXITCODE."
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Inform about the EULA and either force agree or exit.
|
||||
if (!(Test-Path "eula.txt") -or (Get-Content eula.txt | ConvertFrom-StringData).eula) {
|
||||
Write-Host -ForegroundColor Yellow "In order to run a Minecraft server, you need to agree to the Minecraft EULA."
|
||||
Write-Host -ForegroundColor Yellow "You can read the Minecraft EULA here: https://aka.ms/MinecraftEULA"
|
||||
Write-Host -ForegroundColor Yellow "For your convenience, this script can automatically agree for you."
|
||||
Write-Host -ForegroundColor Yellow 'By choosing "Yes" you are assuming full responsibility for agreeing to the EULA.'
|
||||
|
||||
$EULA_QUESTION = "Would you like for this script to agree to the Minecraft EULA in your stead?"
|
||||
$EULA_DECISION = $Host.UI.PromptForChoice('Minecraft EULA Agreement', $EULA_QUESTION, @('&Yes'; '&No'), 1)
|
||||
if ($EULA_DECISION -eq 0) {
|
||||
Write-Host -ForegroundColor Yellow "Agreeing to the EULA per the users choice..."
|
||||
Set-Content -Path "eula.txt" -Value "eula=true"
|
||||
} else {
|
||||
Write-Host -ForegroundColor Red "User won't accept the EULA, exiting..."
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# Run the server
|
||||
if ($PSVersionTable.Platform.startsWith("Win")) {
|
||||
$PLATFORM_ARGS = "win_args.txt"
|
||||
} else {
|
||||
$PLATFORM_ARGS = "unix_args.txt"
|
||||
}
|
||||
|
||||
Write-Host "Running the server..."
|
||||
java @( "@user_jvm_args.txt", "@libraries/net/neoforged/forge/$FORGE_VERSION/$PLATFORM_ARGS" ) nogui %*
|
||||
@@ -2,33 +2,42 @@
|
||||
|
||||
FORGE_VERSION=1.20.1-47.1.84
|
||||
|
||||
# Ensure java is installed\
|
||||
|
||||
# Ensure java is installed
|
||||
if ! command -v java >/dev/null 2>&1; then
|
||||
echo "Java 17 must be installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Install (Neo)Forge
|
||||
# Function to download with either curl or wget
|
||||
download() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -OJL "$1"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget "$1"
|
||||
else
|
||||
echo "Neither curl nor wget found. Please install either curl or wget."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -f forge-1.20.1-47.1.84-installer.jar ]; then
|
||||
curl -OJ https://maven.neoforged.net/releases/net/neoforged/forge/$FORGE_VERSION/forge-$FORGE_VERSION-installer.jar
|
||||
# Install (Neo)Forge
|
||||
if [ ! -f forge-$FORGE_VERSION-installer.jar ]; then
|
||||
download "https://maven.neoforged.net/releases/net/neoforged/forge/$FORGE_VERSION/forge-$FORGE_VERSION-installer.jar"
|
||||
java -jar forge-$FORGE_VERSION-installer.jar --installServer
|
||||
rm run.sh run.bat
|
||||
fi
|
||||
|
||||
# FindMe does not allow distribution on curseforge
|
||||
|
||||
if [ ! -f mods/findme-3.1.1-forge.jar ]; then
|
||||
mkdir mods
|
||||
curl https://mediafilez.forgecdn.net/files/4960/678/findme-3.1.1-forge.jar -o mods/findme-3.1.1-forge.jar
|
||||
mkdir -p mods
|
||||
download "https://mediafilez.forgecdn.net/files/4960/678/findme-3.1.1-forge.jar" -O mods/findme-3.1.1-forge.jar
|
||||
fi
|
||||
|
||||
#Install packwiz if needed
|
||||
# Install packwiz if needed
|
||||
if [ ! -f packwiz-installer-bootstrap.jar ]; then
|
||||
curl -OJL https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar
|
||||
download "https://github.com/packwiz/packwiz-installer-bootstrap/releases/download/v0.0.3/packwiz-installer-bootstrap.jar"
|
||||
fi
|
||||
|
||||
java -jar packwiz-installer-bootstrap.jar -g -s server https://raw.githubusercontent.com/TacoMonkey11/GregTech-Modern-Community-Pack/fix-git-again/pack.toml
|
||||
java -jar packwiz-installer-bootstrap.jar -g -s server https://raw.githubusercontent.com/GregTechCEu/GregTech-Modern-Community-Pack/main/pack.toml
|
||||
|
||||
java @user_jvm_args.txt @libraries/net/neoforged/forge/$FORGE_VERSION/unix_args.txt nogui
|
||||
java @user_jvm_args.txt @libraries/net/neoforged/forge/$FORGE_VERSION/unix_args.txt nogui
|
||||
|
||||
Reference in New Issue
Block a user