As of 1.8, assets are stored by hash, which makes it fiddly to listen to Minecraft's amazing ambient soundtrack outside the game.
This script can be used to copy music files to appopriately-named and organised .ogg
files for easier listening.
2. Save extract-music.js to your Minecraft assets
directory:
- Windows:
%AppData%\.minecraft\assets
- Linux:
~/.minecraft/assets
- OS X:
~/Library/Application Support/minecraft/assets
npm install fs-extra
node extract-music.js
You should see output similar to this, after which .ogg
files will be available in a new sounds/
directory:
./objects/87/87722a59c8d488370f3d430cd4c97a3161081785 -> ./sounds/music/menu/menu3.ogg
./objects/df/df1ff11b79757432c5c3f279e5ecde7b63ceda64 -> ./sounds/music/game/hal1.ogg
./objects/62/6254527d626a2c7d80901cc2e62dce3ba4bd81f6 -> ./sounds/music/game/creative/creative6.ogg
...
I think for people like me you should have included a version that extracts and renames all sounds because that's what I wanted:
var fs = require('fs-extra')
var objects = require('./indexes/1.12.json').objects
for (var filePath in objects) {
var copyPath = filePath.replace('minecraft/', './')
var hash = objects[filePath].hash
var objectPath = './objects/' + hash.substring(0, 2) + '/' + hash
console.log(objectPath, '->', copyPath)
fs.copySync(objectPath, copyPath)
}
And you should also have said:
Anyway, this was still a massive help, even when it was a bit confusing.