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

@@ -86,7 +86,7 @@
"ffmpegExtracting": "ffmpeg zip 압축 해제 중…", "ffmpegExtracting": "ffmpeg zip 압축 해제 중…",
"ffmpegReady": "ffmpeg.exe 준비 완료: {{path}}", "ffmpegReady": "ffmpeg.exe 준비 완료: {{path}}",
"baseExtract": "베이스 리소스팩 압축 해제: {{name}}", "baseExtract": "베이스 리소스팩 압축 해제: {{name}}",
"baseShaderOverrideWarn": "경고: 베이스 리소스팩 vanilla 셰이더 오버라이드(assets/minecraft/shaders/{{path}}) 가 포함됨. mcVersion {{mc}} 와 호환되지 않으면 셰이더 컴파일이 실패할 수 있습니다.", "baseShaderOverrideStripped": "베이스 리소스팩 vanilla 셰이더 오버라이드 제거: assets/minecraft/shaders/{{path}} mcVersion {{mc}} (pack_format {{format}}) 의 새 GLSL API 와 호환되지 않아 결과 zip 에서 제외했습니다.",
"packFormatMatched": "pack_format = {{format}} (mcVersion {{matched}})", "packFormatMatched": "pack_format = {{format}} (mcVersion {{matched}})",
"packFormatFallback": "pack_format = {{format}} (mcVersion \"{{version}}\" 매칭 실패, 최신 폴백)", "packFormatFallback": "pack_format = {{format}} (mcVersion \"{{version}}\" 매칭 실패, 최신 폴백)",
"soundsMerged": "기존 sounds.json 병합 ({{count}}개 항목)", "soundsMerged": "기존 sounds.json 병합 ({{count}}개 항목)",

View File

@@ -50,20 +50,6 @@ export async function buildResourcepackZip(opts: BuildResourcepackOptions): Prom
if (opts.baseZipPath) { if (opts.baseZipPath) {
opts.log?.(t('log.baseExtract', { name: path.basename(opts.baseZipPath) })) opts.log?.(t('log.baseExtract', { name: path.basename(opts.baseZipPath) }))
await extract(opts.baseZipPath, { dir: root }) 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') const soundsDir = path.join(root, 'assets', NAMESPACE, 'sounds')
@@ -78,6 +64,30 @@ export async function buildResourcepackZip(opts: BuildResourcepackOptions): Prom
} else { } else {
opts.log?.(t('log.packFormatFallback', { format: resolved.format, version: opts.mcVersion })) 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 가 폐기되고 // pack_format > 64 (즉 1.21.9+) 부터는 supported_formats 가 폐기되고
// min_format / max_format 가 필수다. 그 이하는 종전대로 supported_formats 사용. // min_format / max_format 가 필수다. 그 이하는 종전대로 supported_formats 사용.
const packMeta: Record<string, unknown> = { const packMeta: Record<string, unknown> = {