Skip to content

Commit 5a076b5

Browse files
committed
🩹 Remove unused code for multi target version exports
1 parent a48ef40 commit 5a076b5

File tree

3 files changed

+52
-54
lines changed

3 files changed

+52
-54
lines changed

src/systems/datapackCompiler/index.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { Variant } from '../../variants'
1717
import type { IRenderedAnimation } from '../animationRenderer'
1818
import mcbFiles from '../datapackCompiler/mcbFiles'
1919
import { IntentionalExportError } from '../exporter'
20-
import { AJMeta, PackMeta, type PackMetaFormats, SUPPORTED_MINECRAFT_VERSIONS } from '../global'
20+
import { AJMeta, PackMeta, SUPPORTED_MINECRAFT_VERSIONS } from '../global'
2121
import { JsonText } from '../jsonText'
2222
import { JsonTextParser } from '../jsonText/parser'
2323
import type { AnyRenderedNode, IRenderedRig } from '../rigRenderer'
@@ -830,28 +830,28 @@ export default async function compileDataPack(
830830
packMeta.content.pack.pack_format = getDataPackFormat(targetVersions[0])
831831
packMeta.content.pack.description ??= `Animated Java Data Pack for ${targetVersions.join(', ')}`
832832

833-
if (targetVersions.length > 1) {
834-
packMeta.content.pack.supported_formats = []
835-
packMeta.content.overlays ??= {}
836-
packMeta.content.overlays.entries ??= []
837-
838-
for (const version of targetVersions) {
839-
const format: PackMetaFormats = getDataPackFormat(version)
840-
packMeta.content.pack.supported_formats.push(format)
841-
842-
const existingOverlay = packMeta.content.overlays.entries.find(
843-
e => e.directory === `animated_java_${version.replaceAll('.', '_')}`
844-
)
845-
if (!existingOverlay) {
846-
packMeta.content.overlays.entries.push({
847-
directory: `animated_java_${version.replaceAll('.', '_')}`,
848-
formats: format,
849-
})
850-
} else {
851-
existingOverlay.formats = format
852-
}
853-
}
854-
}
833+
// if (targetVersions.length > 1) {
834+
// packMeta.content.pack.supported_formats = []
835+
// packMeta.content.overlays ??= {}
836+
// packMeta.content.overlays.entries ??= []
837+
838+
// for (const version of targetVersions) {
839+
// const format: PackMetaFormats = getDataPackFormat(version)
840+
// packMeta.content.pack.supported_formats.push(format)
841+
842+
// const existingOverlay = packMeta.content.overlays.entries.find(
843+
// e => e.directory === `animated_java_${version.replaceAll('.', '_')}`
844+
// )
845+
// if (!existingOverlay) {
846+
// packMeta.content.overlays.entries.push({
847+
// directory: `animated_java_${version.replaceAll('.', '_')}`,
848+
// formats: format,
849+
// })
850+
// } else {
851+
// existingOverlay.formats = format
852+
// }
853+
// }
854+
// }
855855

856856
globalCoreFiles.set(PathModule.join(options.dataPackFolder, 'pack.mcmeta'), {
857857
content: autoStringify(packMeta.toJSON()),

src/systems/global.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,21 @@ export type PackMetaFormats = number | number[] | { min_inclusive: number; max_i
116116

117117
interface OverlayEntry {
118118
directory?: string
119-
/** Since 1.21.9 */
120-
min_format?: number
121-
/** Since 1.21.9 */
122-
max_format?: number
123119
/** Minecraft enforces this field does not to exist if the pack doesn't support versions older than 1.21.9 */
124120
formats?: PackMetaFormats
121+
// Below since 1.21.9
122+
min_format?: number
123+
max_format?: number
125124
}
126125
export interface SerializedPackMeta {
127126
pack?: {
128127
pack_format?: number
129-
/** Since 1.21.9 */
130-
min_format?: number
131-
/** Since 1.21.9 */
132-
max_format?: number
133128
/** Minecraft enforces this field does not to exist if the pack doesn't support versions older than 1.21.9 */
134129
supported_formats?: PackMetaFormats[]
135130
description?: string
131+
// Below since 1.21.9
132+
min_format?: number
133+
max_format?: number
136134
}
137135
features?: {
138136
enabled?: string[]

src/systems/resourcepackCompiler/index.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IntentionalExportError } from '../exporter'
44
import { type IRenderedRig } from '../rigRenderer'
55
import type { ExportedFile } from '../util'
66

7-
import { AJMeta, PackMeta, SUPPORTED_MINECRAFT_VERSIONS, type PackMetaFormats } from '../global'
7+
import { AJMeta, PackMeta, SUPPORTED_MINECRAFT_VERSIONS } from '../global'
88
import EXPORT_1_20_4 from './1.20.4'
99
import EXPORT_1_21_2 from './1.21.2'
1010
import EXPORT_1_21_4 from './1.21.4'
@@ -114,28 +114,28 @@ export default async function compileResourcePack(
114114
', '
115115
)}`
116116

117-
if (targetVersions.length > 1) {
118-
packMeta.content.pack.supported_formats ??= []
119-
packMeta.content.overlays ??= {}
120-
packMeta.content.overlays.entries ??= []
121-
122-
for (const version of targetVersions) {
123-
const format: PackMetaFormats = getResourcePackFormat(version)
124-
packMeta.content.pack.supported_formats.push(format)
125-
126-
const existingOverlay = packMeta.content.overlays.entries.find(
127-
e => e.directory === `animated_java_${version.replaceAll('.', '_')}`
128-
)
129-
if (!existingOverlay) {
130-
packMeta.content.overlays.entries.push({
131-
directory: `animated_java_${version.replaceAll('.', '_')}`,
132-
formats: format,
133-
})
134-
} else {
135-
existingOverlay.formats = format
136-
}
137-
}
138-
}
117+
// if (targetVersions.length > 1) {
118+
// packMeta.content.pack.supported_formats ??= []
119+
// packMeta.content.overlays ??= {}
120+
// packMeta.content.overlays.entries ??= []
121+
122+
// for (const version of targetVersions) {
123+
// const format: PackMetaFormats = getResourcePackFormat(version)
124+
// packMeta.content.pack.supported_formats.push(format)
125+
126+
// const existingOverlay = packMeta.content.overlays.entries.find(
127+
// e => e.directory === `animated_java_${version.replaceAll('.', '_')}`
128+
// )
129+
// if (!existingOverlay) {
130+
// packMeta.content.overlays.entries.push({
131+
// directory: `animated_java_${version.replaceAll('.', '_')}`,
132+
// formats: format,
133+
// })
134+
// } else {
135+
// existingOverlay.formats = format
136+
// }
137+
// }
138+
// }
139139

140140
globalCoreFiles.set(PathModule.join(options.resourcePackFolder, 'pack.mcmeta'), {
141141
content: autoStringify(packMeta.toJSON()),

0 commit comments

Comments
 (0)