Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Lupus590/f8ac79e19a08f19ce4eb0d341178ce5a to your computer and use it in GitHub Desktop.
Save Lupus590/f8ac79e19a08f19ce4eb0d341178ce5a to your computer and use it in GitHub Desktop.
$curseThinkingPackLocation = "C:\Games\Minecraft\Curse\Instances\A Thinking Pack 2" #Join-Path $env:USERPROFILE "Twitch\Minecraft\Instances\A Thinking Pack 2"
$zipOutputLocation = Join-Path $env:USERPROFILE "Desktop\A Thinking Pack 2.zip"
$toZip = @("./config", ".\mods", ".\manifest.json", ".\modlist.html")
if(Test-Path -Path $zipOutputLocation)
{
echo "The output file already exists, should I overwrite it (Y/N)?"
$continue = Read-Host
if($continue -ne "y")
{
echo Aborting
return
}
}
pushd
cd $curseThinkingPackLocation
Compress-Archive -Path $toZip -DestinationPath $zipOutputLocation -Force
echo "Zipped $($curseThinkingPackLocation)"
echo "to $($zipOutputLocation)"
echo "containing $($toZip)"
popd
# curse forge modpack: https://www.curseforge.com/minecraft/modpacks/a-thinking-pack-2
$curseThinkingPackLocation = "C:\Games\Minecraft\Curse\Instances\A Thinking Pack 2" # Join-Path $env:USERPROFILE "Twitch\Minecraft\Instances\A Thinking Pack 2"
$zipOutputLocation = Join-Path $env:USERPROFILE "Desktop\A Thinking Pack 2.zip"
$toZip = @("./config", ".\mods", ".\manifest.json", ".\modlist.html")
if(Test-Path -Path $zipOutputLocation)
{
echo "The output file already exists, should I overwrite it (Y/N)?"
$continue = Read-Host
if($continue -ne "y")
{
echo Aborting
return
}
Remove-Item $zipOutputLocation -Force
}
$tempDir = Join-Path (Join-Path $env:TEMP $([System.IO.Path]::GetRandomFileName())) "A Thinking Pack 2"
echo "working dir $($tempDir)"
New-Item -ItemType Directory -Path $tempDir | Out-Null # noisy commandlet
New-Item -ItemType Directory -Path (Join-Path $tempDir ".minecraft") | Out-Null # noisy commandlet
pushd
cd $curseThinkingPackLocation
Copy-Item -Path $toZip -Destination (Join-Path $tempDir ".minecraft")
echo ".minecraft/coremods
.minecraft/resourcepacks
.minecraft/saves
.minecraft/screenshots
.minecraft/texturepacks" > (Join-Path $tempDir ".packignore")
echo "InstanceType=OneSix
OverrideCommands=false
OverrideConsole=false
OverrideJavaArgs=false
OverrideJavaLocation=false
OverrideMemory=false
OverrideWindow=false
iconKey=default
name=A Thinking Pack 2
notes=
" > (Join-Path $tempDir "instance.cfg")
echo "{
`"components`": [
{
`"cachedName`": `"LWJGL 2`",
`"cachedVersion`": `"2.9.4-nightly-20150209`",
`"cachedVolatile`": true,
`"dependencyOnly`": true,
`"uid`": `"org.lwjgl`",
`"version`": `"2.9.4-nightly-20150209`"
},
{
`"cachedName`": `"Minecraft`",
`"cachedRequires`": [
{
`"suggests`": `"2.9.4-nightly-20150209`",
`"uid`": `"org.lwjgl`"
}
],
`"cachedVersion`": `"1.12.2`",
`"important`": true,
`"uid`": `"net.minecraft`",
`"version`": `"1.12.2`"
},
{
`"cachedName`": `"Forge`",
`"cachedRequires`": [
{
`"equals`": `"1.12.2`",
`"uid`": `"net.minecraft`"
}
],
`"cachedVersion`": `"14.23.5.2847`",
`"uid`": `"net.minecraftforge`",
`"version`": `"14.23.5.2847`"
}
],
`"formatVersion`": 1
}
" > (Join-Path $tempDir "mmc-pack.json")
Compress-Archive -Path (Join-Path $tempDir .) -DestinationPath $zipOutputLocation # can't import
#7z a $zipOutputLocation (Join-Path $tempDir .) # can import # aquire from: https://www.7-zip.org/download.html
echo "Zipped $($curseThinkingPackLocation)"
echo "to $($zipOutputLocation)"
echo "containing $($toZip)"
Remove-Item -Path $tempDir -Recurse -Force
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment