forked from Teahouse-Studios/mcwzh-meme-resourcepack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preset_build.js
149 lines (144 loc) · 3.42 KB
/
preset_build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
const { JavaPackBuilder, ModuleParser } = require('memepack-builder')
const { writeFileSync, existsSync, mkdirSync, readFileSync } = require('fs')
const { resolve } = require('path')
const PACK_VERSION = '1.9.0'
const preset_args = [
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack'],
collection: ['choice_modules_1'],
},
mod: [],
format: 9,
compatible: false,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: ['choice_modules_1'],
},
mod: ['all'],
format: 9,
compatible: false,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: [],
},
mod: [],
format: 9,
compatible: false,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: [],
},
mod: [],
format: 9,
compatible: false,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: ['choice_modules_1'],
},
mod: ['all'],
format: 9,
compatible: true,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: ['choice_modules_1'],
},
mod: [],
format: 9,
compatible: true,
},
{
platform: 'java',
type: 'normal',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: [],
},
mod: [],
format: 9,
compatible: true,
},
{
platform: 'java',
type: 'legacy',
modules: {
resource: ['meme_resource_pack', 'lang_sfw'],
collection: ['version_1.12.2-1.15.2'],
},
mod: [],
format: 3,
compatible: false,
},
]
const preset_name = [
`mcwzh-meme_v${PACK_VERSION}.zip`,
`mcwzh-meme_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_nomod_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_nomod_noresource_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_nomod_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_compatible_nomod_noresource_sfw_v${PACK_VERSION}.zip`,
`mcwzh-meme_legacy_nomod_noresource_sfw_v${PACK_VERSION}.zip`,
]
async function start() {
const jeModules = new ModuleParser()
jeModules.addSearchPaths(resolve(__dirname, './modules'))
;(function () {
const allMappings = JSON.parse(
readFileSync(resolve(__dirname, './mappings/all_mappings'), 'utf-8'),
)
let obj = {}
for (const mapping of allMappings) {
const content = JSON.parse(
readFileSync(resolve(__dirname, `./mappings/${mapping}.json`)),
)
obj = { ...obj, ...content }
}
writeFileSync(
resolve(__dirname, './mappings/mapping.json'),
JSON.stringify(obj),
)
})()
const je = new JavaPackBuilder(
await jeModules.searchModules(),
resolve(__dirname, './modules/priority.txt'),
resolve(__dirname, './mappings/mapping.json'),
)
if (!existsSync('./builds')) {
mkdirSync('./builds')
}
for (const [i, arg] of preset_args.entries()) {
try {
let r = await je.build(arg)
console.log(arg, preset_name[i])
writeFileSync(resolve(__dirname, `./builds/${preset_name[i]}`), r)
} catch (e) {
console.error(e)
process.exit(1)
}
}
process.exit(0)
}
start()