resourcepack: strip vanilla shader overrides when pack_format > 64

Reviewer was right that warn-only let broken zips through. On 1.21.9+
(pack_format > 64) the vanilla shader GLSL API changed (ProjMat, FogColor
etc.) so any base pack carrying old assets/minecraft/shaders/* fails to
compile and causes the same "리소스 새로고침 실패" the pack.mcmeta fix
addressed. Strip that directory at build time when the target pack_format
exceeds 64; keep textures/models/sounds intact and log what was removed.
On <= 64 the old shaders still work, so leave the base pack untouched.
This commit is contained in:
2026-05-14 21:34:30 +09:00
parent 9cb7c05b43
commit 40b2ff81f5
2 changed files with 25 additions and 15 deletions

View File

@@ -50,20 +50,6 @@ export async function buildResourcepackZip(opts: BuildResourcepackOptions): Prom
if (opts.baseZipPath) {
opts.log?.(t('log.baseExtract', { name: path.basename(opts.baseZipPath) }))
await extract(opts.baseZipPath, { dir: root })
// vanilla 셰이더 오버라이드(assets/minecraft/shaders/) 가 있으면 경고만 띄운다.
// 자동 제거는 사용자의 의도된 룩을 해칠 수 있어 하지 않는다.
const vanillaShaderDir = path.join(root, 'assets', 'minecraft', 'shaders')
try {
const stat = await fs.stat(vanillaShaderDir)
if (stat.isDirectory()) {
const entries = await fs.readdir(vanillaShaderDir)
if (entries.length > 0) {
opts.log?.(t('log.baseShaderOverrideWarn', { path: entries.join(', '), mc: opts.mcVersion }))
}
}
} catch {
// 없으면 정상. 무시.
}
}
const soundsDir = path.join(root, 'assets', NAMESPACE, 'sounds')
@@ -78,6 +64,30 @@ export async function buildResourcepackZip(opts: BuildResourcepackOptions): Prom
} else {
opts.log?.(t('log.packFormatFallback', { format: resolved.format, version: opts.mcVersion }))
}
// 1-a) pack_format > 64 (1.21.9+) 에서는 vanilla 셰이더 GLSL API 가 바뀌어
// 구버전 베이스팩의 assets/minecraft/shaders/* 가 컴파일 자체가 실패한다.
// 결과적으로 "리소스 새로고침 실패" 가 다시 뜨므로, 이 경우엔 해당 디렉터리를
// 결과 zip 에서 제거한다. 텍스처/모델 등 나머지 자산은 그대로 유지.
if (opts.baseZipPath && resolved.format > 64) {
const vanillaShaderDir = path.join(root, 'assets', 'minecraft', 'shaders')
try {
const stat = await fs.stat(vanillaShaderDir)
if (stat.isDirectory()) {
const entries = await fs.readdir(vanillaShaderDir)
if (entries.length > 0) {
await fs.rm(vanillaShaderDir, { recursive: true, force: true })
opts.log?.(t('log.baseShaderOverrideStripped', {
path: entries.join(', '),
mc: opts.mcVersion,
format: resolved.format
}))
}
}
} catch {
// 없으면 정상. 무시.
}
}
// pack_format > 64 (즉 1.21.9+) 부터는 supported_formats 가 폐기되고
// min_format / max_format 가 필수다. 그 이하는 종전대로 supported_formats 사용.
const packMeta: Record<string, unknown> = {