From 40b2ff81f53c474611c49ddc6d0c1af6bb1090f3 Mon Sep 17 00:00:00 2001 From: claude-bot Date: Thu, 14 May 2026 21:34:30 +0900 Subject: [PATCH] resourcepack: strip vanilla shader overrides when pack_format > 64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- locales/installer-rp/ko-kr.json | 2 +- src/installer-rp/pack.ts | 38 +++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/locales/installer-rp/ko-kr.json b/locales/installer-rp/ko-kr.json index 8043447..178592b 100644 --- a/locales/installer-rp/ko-kr.json +++ b/locales/installer-rp/ko-kr.json @@ -86,7 +86,7 @@ "ffmpegExtracting": "ffmpeg zip 압축 해제 중…", "ffmpegReady": "ffmpeg.exe 준비 완료: {{path}}", "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}})", "packFormatFallback": "pack_format = {{format}} (mcVersion \"{{version}}\" 매칭 실패, 최신 폴백)", "soundsMerged": "기존 sounds.json 병합 ({{count}}개 항목)", diff --git a/src/installer-rp/pack.ts b/src/installer-rp/pack.ts index cf45908..7a33ef9 100644 --- a/src/installer-rp/pack.ts +++ b/src/installer-rp/pack.ts @@ -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 = {