Created
August 6, 2020 15:13
-
-
Save mkaraki/3a1502b7f5b6695ef28689ef39fd6b59 to your computer and use it in GitHub Desktop.
[PowerShell Script] Export default Minecraft assets with human readable resource name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$objects_dir = "C:\Users\araki-mk\AppData\Roaming\.minecraft\assets\objects" # Full path to .minecraft/assets/objects | |
$listjson = "C:\Users\araki-mk\AppData\Roaming\.minecraft\assets\indexes\1.16.json" # Full path to json file in .minecraft/assets/indexes | |
$exportdir = "C:\Users\araki-mk\AppData\Roaming\.minecraft\assets\extracted" # Full path to export directory | |
# =================== | |
$json = Get-Content $listjson | |
$list = ConvertFrom-Json -InputObject $json | |
foreach ($r in $list.objects.psobject.Properties) { | |
$fname = $r.Name | |
$afname = $list.objects.$fname.hash | |
$hash_dirname = $afname.Substring(0, 2); | |
$from = $objects_dir + '\' + $hash_dirname + '\' + $afname; | |
$to = $exportdir + '\' + $fname; | |
$destdir = Split-Path $to -Parent; | |
if (!(Test-Path -Path $destdir)) { $0_ = New-Item $destdir -Type Directory } | |
Copy-Item -Path $from -Destination $to | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment