Files
AstraCauldron/tools/check-models.ps1
T

20 lines
1.1 KiB
PowerShell
Raw Normal View History

param([string]$MinecraftDirectory = "$env:APPDATA/.minecraft")
$ErrorActionPreference = 'Stop'
$repo = Split-Path $PSScriptRoot -Parent
$version = Get-Content -Raw -LiteralPath "$MinecraftDirectory/versions/26.2/26.2.json" | ConvertFrom-Json
$classpath = @("$MinecraftDirectory/versions/26.2/26.2.jar") + @(
$version.libraries | Where-Object { $_.downloads.artifact.path } | ForEach-Object {
"$MinecraftDirectory/libraries/" + $_.downloads.artifact.path
} | Where-Object { Test-Path -LiteralPath $_ }
)
New-Item -ItemType Directory -Force -Path "$repo/build" | Out-Null
$arguments = @(
'--class-path', ('"' + (($classpath -join ';').Replace('\', '/')) + '"'),
('"' + "$PSScriptRoot/CheckSoupModels.java".Replace('\', '/') + '"'),
('"' + "$repo/src/main/resources/astra-itemsadder/astradev_soups/resourcepack/assets/astradev_soups".Replace('\', '/') + '"')
)
$argumentFile = "$repo/build/check-models.args"
Set-Content -Encoding utf8 -LiteralPath $argumentFile -Value $arguments
& java "@$argumentFile"
if ($LASTEXITCODE -ne 0) { throw 'Minecraft model validation failed' }