installation guide and resources

This commit is contained in:
Satria 2026-07-25 11:42:33 +07:00
commit 9bce1187fe
7 changed files with 360 additions and 3 deletions

78
scripts/installer.ps1 Normal file
View file

@ -0,0 +1,78 @@
$mcVersion = "1.21.11"
$loaderVersion = "0.19.2"
$mcPath = "$env:APPDATA\.minecraft"
$modpackDir = "$mcPath\profiles\satr14-server"
$fabricJarUrl = "https://maven.fabricmc.net/net/fabricmc/fabric-installer/1.0.0/fabric-installer-1.0.0.jar"
$javaUrl = "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13.zip"
Get-Process MinecraftLauncher -ErrorAction SilentlyContinue | Stop-Process -Force
if (!(Test-Path "$modpackDir\mods")) { New-Item -ItemType Directory -Path "$modpackDir\mods" -Force }
$configDir = Join-Path $modpackDir "config"
if (!(Test-Path $configDir)) { New-Item -ItemType Directory -Path $configDir -Force }
$javaZip = "$env:TEMP\java21.zip"
$javaExtracted = "$env:TEMP\java21_extracted"
$javaExe = Get-ChildItem -Path $javaExtracted -Filter java.exe -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
if ($null -eq $javaExe) {
if (!(Test-Path $javaZip)) {
Write-Host "Downloading Java 21..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $javaUrl -OutFile $javaZip
}
Write-Host "Extracting Java..." -ForegroundColor Yellow
Expand-Archive -Path $javaZip -DestinationPath $javaExtracted -Force
$javaExe = Get-ChildItem -Path $javaExtracted -Filter java.exe -Recurse | Select-Object -First 1
} else {
Write-Host "Java 21 already found, skipping download." -ForegroundColor Gray
}
$tempJar = "$env:TEMP\fabric-installer.jar"
if (!(Test-Path $tempJar)) {
Write-Host "Downloading Fabric Installer..." -ForegroundColor Cyan
Invoke-WebRequest -Uri $fabricJarUrl -OutFile $tempJar
}
Write-Host "Running Fabric Installer..." -ForegroundColor Cyan
& $javaExe.FullName -jar $tempJar client -mcversion $mcVersion -loader $loaderVersion -noprofile
$mods = @(
"https://cdn.modrinth.com/data/P7dR8mSH/versions/i5tSkVBH/fabric-api-0.141.3%2B1.21.11.jar",
"https://cdn.modrinth.com/data/8IFHiuMI/versions/6ir0JEFa/simplemodsync-fabric-1.21.11-1.3.1.jar"
)
foreach ($url in $mods) {
$rawName = [System.IO.Path]::GetFileName($url)
$filename = [uri]::UnescapeDataString($rawName)
$targetPath = Join-Path "$modpackDir\mods" $filename
if (!(Test-Path $targetPath)) {
Write-Host "Downloading $filename..." -ForegroundColor Yellow
Invoke-WebRequest -Uri $url -OutFile $targetPath
} else {
Write-Host "$filename exists, skipping." -ForegroundColor Gray
}
}
$syncConfig = @{ auto_download = $true; download_url = "https://git.satr14.my.id/satr14/server-modpack/raw/branch/main/scripts/mod-sync.json" }
$syncConfig | ConvertTo-Json | Set-Content (Join-Path $configDir "simplemodsync.json") -Encoding UTF8
$targetFiles = @("launcher_profiles.json", "launcher_profiles_microsoft_store.json")
foreach ($file in $targetFiles) {
$profilePath = Join-Path $mcPath $file
if (Test-Path $profilePath) {
$json = Get-Content $profilePath -Raw | ConvertFrom-Json
$newProfile = [PSCustomObject]@{
name = "satr14's server modpack"
gameDir = $modpackDir
lastVersionId = "fabric-loader-$loaderVersion-$mcVersion"
javaArgs = "-Xmx4G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled"
icon = "Enchanting_Table"
}
$json.profiles | Add-Member -MemberType NoteProperty -Name "server_sync_pack" -Value $newProfile -Force
$json | ConvertTo-Json -Depth 32 | Set-Content $profilePath
}
}
Write-Host "Sync Complete!" -ForegroundColor Green
Pause