Files
amnesia/java-client/tools/fetch-mappings.ps1
T
2026-11-09 21:22:29 -06:00

14 lines
735 B
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$deps = Join-Path $root 'build/deps'
New-Item -ItemType Directory -Path $deps -Force | Out-Null
$version = (Invoke-RestMethod 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json').versions |
Where-Object id -eq '1.21.1' | Select-Object -First 1
if (-not $version) { throw 'Mojang did not list Java 1.21.1.' }
$mappings = (Invoke-RestMethod $version.url).downloads.client_mappings
$file = Join-Path $deps 'client.txt'
Invoke-WebRequest $mappings.url -OutFile $file
if ((Get-FileHash -LiteralPath $file -Algorithm SHA1).Hash -ne '2244b6f072256667bcd9a73df124d6c58de77992') {
throw 'The downloaded mappings did not match Mojang Java 1.21.1.'
}