Files
minecraft_launcher/src/installer-rp/packFormat.ts
claude-bot 1665f05c55 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.
2026-05-14 21:43:31 +09:00

51 lines
1.6 KiB
TypeScript

// Minecraft Java Edition 버전 → resource pack format 번호.
// 출처: https://minecraft.wiki/w/Pack_format (수동 동기화).
// 1.21.9 부터는 minor 버전(예: 69.0)이 도입됐지만 JSON Number 로 0 차이는
// 표현되지 않으므로 정수만 사용한다.
const TABLE: Array<readonly [string, number]> = [
['1.21', 34],
['1.21.1', 34],
['1.21.2', 42],
['1.21.3', 42],
['1.21.4', 46],
['1.21.5', 55],
['1.21.6', 63],
['1.21.7', 64],
['1.21.8', 64],
['1.21.9', 69],
['1.21.10', 69],
['1.21.11', 75],
['26.1', 84],
['26.1.1', 84],
['26.1.2', 84],
['26.2', 86]
]
/** 테이블에서 마지막(=최신) 항목의 포맷. 알 수 없는 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
/** pack.mcmeta 에 들어갈 pack_format 값. */
format: number
}
/**
* mcVersion 문자열 ("1.21.6", "26.1.2", …) 에서 pack_format 을 찾는다.
* 정확히 일치하는 게 있으면 그 값, 없으면 가장 최근 알려진 포맷을 폴백.
*/
export function resolveResourcePackFormat(mcVersion: string): ResolvedFormat {
const key = (mcVersion || '').trim()
for (const [v, f] of TABLE) {
if (v === key) return { matched: v, format: f }
}
return { matched: null, format: LATEST_KNOWN_FORMAT }
}