Skip to content

Instantly share code, notes, and snippets.

@kkotaro0111
Last active January 16, 2016 06:07
Show Gist options
  • Save kkotaro0111/8fc2a2f90874581ea1dc to your computer and use it in GitHub Desktop.
Save kkotaro0111/8fc2a2f90874581ea1dc to your computer and use it in GitHub Desktop.
マイクラの /assets/objects/ から、ogg音源を取り出すNodeスクリプト
console.log("start");
var fs = require('fs');
const MINECRAFT_PATH = "<need specified your minecraft dir path>/minecraft/";
const SPATH = MINECRAFT_PATH + "assets/objects/";
const DPATH = "<need specified your destination dir path>/";
var json = require(MINECRAFT_PATH + 'assets/indexes/1.8.json');
var o = json.objects;
for( var key in o ){
if( /.*\.ogg$/.test(key)){
var swap_key = key.replace(/\//g, "_");
var hash = o[key].hash;
var dir = hash.substr(0, 2);
console.log(key, dir + "/" + hash);
var stat = fs.statSync( SPATH + dir + "/" + hash );
var ws = fs.createWriteStream( DPATH + swap_key );
fs.createReadStream( SPATH + dir + "/" + hash).pipe( ws );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment