mirror of
https://github.com/Fabulously-Optimized/fabulously-optimized.git
synced 2024-05-03 03:40:17 +00:00
Add pre-launch and post-exit powershell scripts (#307)
* Add files via upload * cleanup * a * Update post-exit.ps1 * parity * Update pre-launch.ps1 Co-authored-by: Madis Otenurm <Madis0@users.noreply.github.com>
This commit is contained in:
parent
a0376577bb
commit
9bc287f27f
12
Packwiz/post-exit.ps1
Normal file
12
Packwiz/post-exit.ps1
Normal file
|
@ -0,0 +1,12 @@
|
|||
# By Ultrasonic1209
|
||||
|
||||
# Restore packwiz disabled mods to prevent useless redownload
|
||||
Write-Output "Restoring overridden mods for future launches..."
|
||||
Set-Location ".\mods"
|
||||
|
||||
$mods = Get-ChildItem *.jar.disabled
|
||||
|
||||
foreach ( $mod in $mods ) {
|
||||
Move-Item -Path $mod.name -Destination ($mod.FullName).Replace(".disabled","") -Force
|
||||
Write-Output "$($mod.name.Replace(".disabled", '')) restored successfully!"
|
||||
}
|
40
Packwiz/pre-launch.ps1
Normal file
40
Packwiz/pre-launch.ps1
Normal file
|
@ -0,0 +1,40 @@
|
|||
# By Ultrasonic1209
|
||||
|
||||
$mods = @(
|
||||
'ModYouDislike.jar'
|
||||
'AnotherMod.jar'
|
||||
)
|
||||
|
||||
# Upgrading Fabulously Optimized
|
||||
Write-Output "Checking for FO updates..."
|
||||
Set-Location ..
|
||||
|
||||
$json = Get-Content "mmc-pack.json" | ConvertFrom-Json
|
||||
|
||||
$table = $json.components | Where-Object { $_.cachedName -eq "Minecraft" }
|
||||
$mcVersion = $table.version
|
||||
|
||||
if (Test-Path -Path ".\.minecraft") {
|
||||
Set-Location ".\.minecraft"
|
||||
} else {
|
||||
Set-Location ".\minecraft"
|
||||
}
|
||||
|
||||
$processOptions = @{
|
||||
FilePath = $Env:INST_JAVA
|
||||
ArgumentList = "-jar packwiz-installer-bootstrap.jar",
|
||||
"https://raw.githubusercontent.com/Fabulously-Optimized/fabulously-optimized/main/Packwiz/$mcVersion/pack.toml"
|
||||
}
|
||||
Start-Process @processOptions -Wait
|
||||
|
||||
# Disabling the mods
|
||||
Write-Output "Disabling mods..."
|
||||
|
||||
Set-Location ".\mods"
|
||||
foreach ($mod in $mods) {
|
||||
Move-Item -Path $mod -Destination "$mod.disabled" -Force
|
||||
|
||||
if ($?) {
|
||||
Write-Output "$mod disabled successfully!"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue