Skip to content

Commit

Permalink
Update pack formats to 24 (R) / 26 (D)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Jan 23, 2024
1 parent 6f923c0 commit f509674
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Next
- Updated resource pack format to `24`.
- Updated data pack format to `26`.

## 1.3.11
*2024-01-03*
- Fixed incorrect maximum versions being returned in the output of `--list`.
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const packFormat = require('pack-format')
packFormat('1.14.4') // 4
packFormat('1.16.2-pre1', 'resource') // 5
packFormat('20w45a', 'data') // 6
packFormat.LATEST.data // 18
packFormat.LATEST.data // 26
```

Retrieve a list of versions corresponding to a specific `pack_format`, again optionally specifying resource/data pack version.
Expand Down
31 changes: 25 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const START_RELEASES: Record<VersionName, Record<PackType, FormatResult>> = {
'1.19.4': { resource: 12, data: 12 },
'1.20.x': { resource: 15, data: 15 },
'1.20.2': { resource: 18, data: 18 },
'1.20.3': { resource: 22, data: 26 },
'1.20.5': { resource: undefined, data: undefined },
'1.21.x': { resource: undefined, data: undefined },
}

Expand Down Expand Up @@ -47,13 +49,30 @@ const START_SNAPSHOTS: Record<string, Record<PackType, FormatResult>> = {
'23w18a': { resource: 15, data: 15 },
'23w31a': { resource: 16, data: 16 },
'23w32a': { resource: 17, data: 17 },
'23w40a': { resource: 18, data: 19 },
'23w41a': { resource: 18, data: 20 },
'23w42a': { resource: 19, data: 21 },
'23w43a': { resource: 20, data: 22 },
'23w44a': { resource: 20, data: 23 },
'23w45a': { resource: 21, data: 24 },
'23w46a': { resource: 21, data: 25 },
'23w51a': { resource: 22, data: 27 },
'24w03a': { resource: 24, data: 28 },
[fauxCurrentSnapshot]: { resource: undefined, data: undefined },
}

const SPECIAL: Record<number, string[]> = {
4: ['combat1', 'combat2', 'combat3'],
5: ['combat4', 'combat5'],
6: ['combat6', 'combat7a', 'combat7b', 'combat8a', 'combat8b', 'combat8c'],
const SPECIAL: Record<PackType, Record<number, string[]>> = {
resource: {
4: ['combat1', 'combat2', 'combat3'],
5: ['combat4', 'combat5'],
6: ['combat6', 'combat7a', 'combat7b', 'combat8a', 'combat8b', 'combat8c'],
17: ['1.20.2-pre1'],
},
data: {
4: ['combat1', 'combat2', 'combat3'],
5: ['combat4', 'combat5'],
6: ['combat6', 'combat7a', 'combat7b', 'combat8a', 'combat8b', 'combat8c'],
},
}

/**
Expand All @@ -66,8 +85,8 @@ function getPackFormat(version: string, type: PackType = 'resource'): FormatResu
version = version.toString().toLowerCase().trim()

// Special //
for (const format in SPECIAL) {
if (SPECIAL[format].includes(version)) return +format
for (const format in SPECIAL[type]) {
if (SPECIAL[type][format].includes(version)) return +format
}

// Snapshot //
Expand Down
21 changes: 21 additions & 0 deletions test/pack-formats-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ Types:
"1.19.4" (r) 12
"1.20" (r) 15
"1.20.1" (r) 15
"1.20.2" (r) 18
"1.20.2" (d) 18
"1.20.3" (r) 22
"1.20.3" (d) 26
"1.20.4" (r) 22

=== Pre-releases ===

Expand All @@ -47,6 +51,11 @@ Types:
"1.16.2 pre-release 1" (-) 5
"1.19.4-pre1" (r) 13
"1.20.2-pre1" (d) 18
"1.20.3-pre1" (r) 22
"1.20.3-pre1" (d) 26
"1.20.2-pre1" (r) 17
"1.20.2-pre1" (d) 18
"1.20.2-pre2" (r) 18

=== Snapshots ===

Expand Down Expand Up @@ -83,6 +92,18 @@ Types:
"23w31a" (d) 16
"23w32a" (r) 17
"23w32a" (d) 17
"23w41a" (r) 18
"23w42a" (r) 19
"23w43a" (r) 20
"23w43a" (d) 22
"23w44a" (r) 20
"23w44a" (d) 23
"23w45a" (r) 21
"23w45a" (d) 24
"23w51b" (r) 22
"23w51b" (d) 27
"24w03a" (r) 24
"24w03a" (d) 28

=== Special cases ===

Expand Down

0 comments on commit f509674

Please sign in to comment.