Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Minecraft assets extraction script. Put this script into .minecraft/assets
- * and run it from command line. See minecraft folder in .minecraft/assets for
- * your exported resources.
- *
- * @author McHorse
- */
- $json = json_decode(file_get_contents(__DIR__ . '/indexes/1.11.json'), true);
- /* Iterate over objects */
- foreach ($json['objects'] as $key => $value)
- {
- /* Setup variables */
- $hash = $value['hash'];
- $two = substr($hash, 0, 2);
- $path = __DIR__ . "/objects/$two/$hash";
- $dest = __DIR__ . '/' . pathinfo($key, PATHINFO_DIRNAME);
- /* If given file exists, then extract this iterated asset */
- if (file_exists($path))
- {
- if (!file_exists($dest))
- {
- mkdir($dest, 0777, true);
- }
- /* Copy file */
- copy($path, __DIR__ . '/' . $key);
- echo "File by key '$key' was saved!\n";
- }
- else
- {
- echo "Not found '$key'!";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement