Skip to content

Instantly share code, notes, and snippets.

@Buggem
Last active September 30, 2025 10:12
Show Gist options
  • Save Buggem/8df7cef2c3a2accdaca6ba03e7a1003d to your computer and use it in GitHub Desktop.
Save Buggem/8df7cef2c3a2accdaca6ba03e7a1003d to your computer and use it in GitHub Desktop.
Minecraft music extractor
#!/bin/bash
mkdir -p newdir
find . -name "*.json" -type f | while read f; do
cat "$f" | python -m json.tool > "newdir/$f.lol"
sed -n '/music/=' "newdir/$f.lol" | while read line; do
hash=$(sed -n $(expr ${line} + 1)p "newdir/$f.lol" | xargs echo | sed 's/hash: //g' | sed 's/,//g')
filename=$(sed -n ${line}p "newdir/$f.lol" | xargs echo | sed 's/: {//g')
mkdir -p "newdir/$(dirname "$filename")"
cp "$HOME/.minecraft/assets/objects/${hash:0:2}/${hash}" "newdir/$filename"
done
done

Minecraft Music extractor

I wrote it, and it sucks. Feel free to diss me in the comments.

Run in ~/.minecraft/assets/indexes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment