resourcepack: declare compatibility range from 1.21.6 to latest known

Pack.mcmeta now spans pack_format MIN_SUPPORTED_FORMAT (=63, 1.21.6) up to
max(LATEST_KNOWN_FORMAT, resolved.format) so a single build loads on every
MC from 1.21.6 through 26.1.2+ (currently extending to 86 = 26.2). Both
schemas are written: supported_formats for clients on pack_format <= 64,
and min_format/max_format for 1.21.9+ clients. pack_format itself stays
at the build target so newer clients see the pack as current rather than
legacy.
This commit is contained in:
2026-05-14 21:43:31 +09:00
parent 40b2ff81f5
commit 1665f05c55
3 changed files with 19 additions and 10 deletions

View File

@@ -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<string, unknown> = {
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))

View File

@@ -24,6 +24,12 @@ const TABLE: Array<readonly [string, number]> = [
/** 테이블에서 마지막(=최신) 항목의 포맷. 알 수 없는 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