diff --git a/locales/installer-rp/ko-kr.json b/locales/installer-rp/ko-kr.json index 178592b..dbdacea 100644 --- a/locales/installer-rp/ko-kr.json +++ b/locales/installer-rp/ko-kr.json @@ -89,6 +89,7 @@ "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}}\" 매칭 실패, 최신 폴백)", + "packFormatRange": "호환 범위 선언: pack_format {{min}} ~ {{max}} (supported_formats / min_format / max_format 모두 기록)", "soundsMerged": "기존 sounds.json 병합 ({{count}}개 항목)", "ytdlpLine": "yt-dlp> {{line}}" }, diff --git a/src/installer-rp/pack.ts b/src/installer-rp/pack.ts index 7a33ef9..2ab5f6b 100644 --- a/src/installer-rp/pack.ts +++ b/src/installer-rp/pack.ts @@ -2,7 +2,7 @@ import { promises as fs, createWriteStream } from 'node:fs' import path from 'node:path' import archiver from 'archiver' import extract from 'extract-zip' -import { resolveResourcePackFormat } from './packFormat.js' +import { resolveResourcePackFormat, MIN_SUPPORTED_FORMAT, LATEST_KNOWN_FORMAT } from './packFormat.js' import { loadComponentI18n } from '../shared/i18n.js' const { t } = loadComponentI18n('installer-rp') @@ -88,20 +88,22 @@ export async function buildResourcepackZip(opts: BuildResourcepackOptions): Prom // 없으면 정상. 무시. } } - // pack_format > 64 (즉 1.21.9+) 부터는 supported_formats 가 폐기되고 - // min_format / max_format 가 필수다. 그 이하는 종전대로 supported_formats 사용. + // 호환 범위는 1.21.6 (=MIN_SUPPORTED_FORMAT) 부터 알려진 최신까지 선언한다. + // 빌드 타깃이 LATEST_KNOWN_FORMAT 보다 높으면(테이블 갱신 전 신버전) 그 값까지 확장. + const minFmt = Math.min(MIN_SUPPORTED_FORMAT, resolved.format) + const maxFmt = Math.max(LATEST_KNOWN_FORMAT, resolved.format) + // pack_format <= 64 인 MC 는 supported_formats 를, > 64 인 MC 는 min_format/max_format 을 + // 읽는다. 어느 한쪽만 두면 반대편 클라이언트에서 거부되므로 양쪽 모두 기록한다. const packMeta: Record = { description: t('pack.description', { name: opts.packName }), - pack_format: resolved.format - } - if (resolved.format > 64) { - packMeta.min_format = resolved.format - packMeta.max_format = resolved.format - } else { - packMeta.supported_formats = { min_inclusive: resolved.format, max_inclusive: resolved.format } + pack_format: resolved.format, + supported_formats: { min_inclusive: minFmt, max_inclusive: maxFmt }, + min_format: minFmt, + max_format: maxFmt } const mcmeta = { pack: packMeta } await fs.writeFile(path.join(root, 'pack.mcmeta'), JSON.stringify(mcmeta, null, 2) + '\n') + opts.log?.(t('log.packFormatRange', { min: minFmt, max: maxFmt })) // 2) 음악 파일 복사 + sounds.json 생성/병합 const musicFiles = (await fs.readdir(opts.musicDir)) diff --git a/src/installer-rp/packFormat.ts b/src/installer-rp/packFormat.ts index 537761f..161db54 100644 --- a/src/installer-rp/packFormat.ts +++ b/src/installer-rp/packFormat.ts @@ -24,6 +24,12 @@ const TABLE: Array = [ /** 테이블에서 마지막(=최신) 항목의 포맷. 알 수 없는 mcVersion 에 대한 폴백. */ export const LATEST_KNOWN_FORMAT: number = TABLE[TABLE.length - 1][1] +/** + * 리소스팩이 호환된다고 선언할 최소 pack_format. + * 1.21.6 (=63) 부터를 지원 범위 하한으로 둔다. + */ +export const MIN_SUPPORTED_FORMAT = 63 + export interface ResolvedFormat { /** 매칭된 mcVersion 키 (없으면 null). */ matched: string | null