add tools/build-vanilla-pack.sh to build the runtime resource pack from Mojang's client jar
This commit is contained in:
1 parent
a0b7ec3a90
commit
addebffba1
1 file changed
+30
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds the runtime resource pack PixelPics renders from (blockstates, models, textures, items,
|
||||
# atlases, font) straight from Mojang's CLIENT jar — no launcher install needed. The plugin ships no
|
||||
# assets itself; drop the resulting zip into plugins/PixelPics/resourcepack/. Run it once per
|
||||
# Minecraft update. No pack.mcmeta needed (the client jar has none; the loader detects the pack by
|
||||
# its assets/minecraft/blockstates folder).
|
||||
#
|
||||
# Needs: curl, jq, unzip, zip.
|
||||
#
|
||||
# Usage: tools/build-vanilla-pack.sh 26.3 # -> ./vanilla-26.3.zip
|
||||
# tools/build-vanilla-pack.sh 26.3 <output-dir> # -> <output-dir>/vanilla-26.3.zip
|
||||
set -euo pipefail
|
||||
|
||||
VER="${1:?usage: $0 <minecraft-version> [output-dir]}"
|
||||
OUT_DIR="$(mkdir -p "${2:-.}" && cd "${2:-.}" && pwd)"
|
||||
OUT="$OUT_DIR/vanilla-$VER.zip"
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
META="$(curl -fsS https://piston-meta.mojang.com/mc/game/version_manifest_v2.json \
|
||||
| jq -r --arg v "$VER" '.versions[] | select(.id==$v) | .url')"
|
||||
[[ -n "$META" ]] || { echo "Minecraft version $VER not found in Mojang's version manifest"; exit 1; }
|
||||
|
||||
echo "Downloading client jar for $VER ..."
|
||||
curl -fsS -o "$WORK/client.jar" "$(curl -fsS "$META" | jq -r .downloads.client.url)"
|
||||
|
||||
unzip -q "$WORK/client.jar" 'assets/minecraft/'{blockstates,models,textures,items,atlases,font}'/*' -d "$WORK/pack"
|
||||
rm -f "$OUT"
|
||||
(cd "$WORK/pack" && zip -qr "$OUT" .)
|
||||
echo "Wrote $OUT ($(unzip -Z1 "$OUT" | grep -vc '/$') files)"
|
||||
Reference in new issue
Block a user