#!/usr/bin/env bash # Rebuild the merged Java resource pack (ModelEngine + MythicHUD) and recompute sha1. set -euo pipefail PH=/opt/minecraft-stack/packhost ME="/opt/minecraft-stack/data/plugins/ModelEngine/resource pack" MH="/opt/minecraft-stack/data/plugins/MythicHUD/built-pack" B="$PH/build" rm -rf "$B"; mkdir -p "$B" # 1) union of asset trees (no file collisions; namespaces modelengine/ vs mythichud/) cp -a "$ME/assets/." "$B/assets/" cp -a "$MH/assets/." "$B/assets/" # 2) overlay dirs from both (distinct names: 1_21_* vs mythichud-1_21_*) for d in "$ME"/1_21_* "$MH"/mythichud-*; do [ -d "$d" ] && cp -a "$d" "$B/"; done # 2b) Strip ModelEngine's rendertype_entity_translucent core shader (+ its only # consumer, player_shader.glsl). It mis-binds on vanilla 1.21.11 and flickers # the sky; ModelEngine's own pack.mcmeta flags it in sodium.ignored_shaders. # Vanilla's built-in translucent shader takes over; models still render fine. find "$B" -path '*shaders/core/rendertype_entity_translucent.*' -delete find "$B" -path '*shaders/include/player_shader.glsl' -delete # 3) pack.png (cosmetic) from ModelEngine cp -a "$ME/pack.png" "$B/pack.png" # 4) combined pack.mcmeta: base format 15, supported [15,32767], union of overlay entries python3 - "$ME/pack.mcmeta" "$MH/pack.mcmeta" "$B/pack.mcmeta" <<'PY' import json,sys me=json.load(open(sys.argv[1])); mh=json.load(open(sys.argv[2])) out={"pack":{"pack_format":15,"min_format":15,"max_format":32767, "supported_formats":[15,32767], "description":"Bagel's World (ModelEngine + MythicHUD merged)"}} entries=[] for src in (me,mh): entries += src.get("overlays",{}).get("entries",[]) if entries: out["overlays"]={"entries":entries} # keep ModelEngine's sodium hint if present if "sodium" in me: out["sodium"]=me["sodium"] json.dump(out,open(sys.argv[3],"w"),indent=2) PY # 5) zip it (store-level; deterministic ordering) cd "$B" rm -f "$PH/pack.zip" zip -q -X -r "$PH/pack.zip" . -x '.*' cd "$PH" SHA1=$(sha1sum pack.zip | cut -d' ' -f1) echo "$SHA1" > "$PH/pack.sha1" echo "built pack.zip size=$(stat -c%s pack.zip) sha1=$SHA1" # Versioned URL busts Cloudflare's cache (CF keys cache by query string) — bump # ?v= to the sha1 prefix each rebuild, then update server.properties + restart mc-main. echo "server.properties:" echo " resource-pack=https://mcpack.bage1s-media.com/pack.zip?v=${SHA1:0:8}" echo " resource-pack-sha1=$SHA1"