@@ -9,9 +9,8 @@ type ExporterSettings = ReturnType<ReturnType<typeof loadExporter>['getSettings'
99export type ExportData = AnimatedJava . IAnimatedJavaExportData < ExporterSettings >
1010
1111export function loadDataPackGenerator ( ) {
12- const { formatStr, ProgressBarController, ExpectedError, LimitClock } = AnimatedJava . API
13- const { NbtTag, NbtCompound, NbtString, NbtList, NbtInt } = AnimatedJava . API . deepslate
14- const { fileExists, matrixToNbtFloatArray } = loadUtil ( )
12+ const { ProgressBarController, ExpectedError, LimitClock } = AnimatedJava . API
13+ const { fileExists } = loadUtil ( )
1514
1615 return async ( exportData : ExportData ) => {
1716 if ( ! Project ?. animated_java_variants ) throw new Error ( 'No variants found' )
@@ -35,14 +34,7 @@ export function loadDataPackGenerator() {
3534 )
3635
3736 interface IAJMeta {
38- projects : Record <
39- string ,
40- {
41- // tick_functions: string[]
42- // load_functions: string[]
43- file_list : string [ ]
44- }
45- >
37+ projects : Record < string , { file_list : string [ ] } >
4638 }
4739
4840 let content : IAJMeta | undefined
@@ -58,7 +50,7 @@ export function loadDataPackGenerator() {
5850 content = await fs . promises . readFile ( existingMetaFile , 'utf-8' ) . then ( JSON . parse )
5951
6052 if ( ! content . projects ) {
61- const message = `Failed to read the animated_java.mcdata file. (Missing projects). Please delete the file and try again.`
53+ const message = `Failed to read the .ajmeta file. (Missing projects). Please delete the file and try again.`
6254 Blockbench . showMessageBox ( {
6355 title : 'Failed to read .ajmeta' ,
6456 message,
@@ -75,38 +67,24 @@ export function loadDataPackGenerator() {
7567 content . projects [ G . NAMESPACE ] = project
7668
7769 if ( ! project . file_list ) {
78- const message = `Failed to read the animated_java.mcdata file. (Missing project file_list). Please delete the file and try again.`
70+ const message = `Failed to read the .ajmeta file. (Missing project file_list). Please delete the file and try again.`
7971 Blockbench . showMessageBox ( {
8072 title : 'Failed to read .ajmeta' ,
8173 message,
8274 } )
8375 throw new ExpectedError ( message )
8476 }
8577
86- // if (!project.tick_functions) {
87- // const message = `Failed to read the animated_java.mcdata file. (Missing project tick_functions). Please delete the file and try again.`
88- // Blockbench.showMessageBox({
89- // title: 'Failed to read .ajmeta',
90- // message,
91- // })
92- // throw new ExpectedError(message)
93- // }
94-
95- // if (!project.load_functions) {
96- // const message = `Failed to read the animated_java.mcdata file. (Missing project load_functions). Please delete the file and try again.`
97- // Blockbench.showMessageBox({
98- // title: 'Failed to read .ajmeta',
99- // message,
100- // })
101- // throw new ExpectedError(message)
102- // }
103-
10478 progress . total += project . file_list . length
10579 const clock = new LimitClock ( 10 )
10680 for ( let path of project . file_list ) {
10781 progress . add ( 1 )
10882 await clock . sync ( ) . then ( b => b && progress . update ( ) )
109- if ( path . endsWith ( 'tick.json' ) || path . endsWith ( 'load.json' ) ) continue
83+ if (
84+ PathModule . basename ( path ) === 'tick.json' ||
85+ PathModule . basename ( path ) === 'load.json'
86+ )
87+ continue
11088 path = PathModule . join ( G . DATAPACK_EXPORT_PATH , path )
11189 await fs . promises . unlink ( path ) . catch ( ( ) => { } )
11290 const dirPath = PathModule . dirname ( path )
@@ -116,27 +94,11 @@ export function loadDataPackGenerator() {
11694 }
11795 project . file_list = G . DATAPACK . getAllFilePaths ( )
11896
119- // tickFunctionTag.customJsonMerger = (a, b) => {
120- // a.values = a.values.filter(v => !project.tick_functions.includes(v))
121- // a.values.push(...b.values)
122- // return a
123- // }
124-
125- // loadFunctionTag.customJsonMerger = (a, b) => {
126- // a.values = a.values.filter(v => !project.load_functions.includes(v))
127- // a.values.push(...b.values)
128- // return a
129- // }
130-
13197 await fs . promises . rm ( existingMetaFile )
13298 } else {
13399 content = {
134100 projects : {
135- [ G . NAMESPACE ] : {
136- // tick_functions: tickFunctionTag.content.values,
137- // load_functions: loadFunctionTag.content.values,
138- file_list : G . DATAPACK . getAllFilePaths ( ) ,
139- } ,
101+ [ G . NAMESPACE ] : { file_list : G . DATAPACK . getAllFilePaths ( ) } ,
140102 } ,
141103 }
142104 }
0 commit comments