description and filename changes
This commit is contained in:
parent
e1063f2507
commit
0d5ba93b6e
34
packgen.js
34
packgen.js
@ -28,14 +28,24 @@ const urlReq = function (reqUrl, options, cb) {
|
||||
};
|
||||
|
||||
let piston = 'https://piston-meta.mojang.com/mc/game/version_manifest_v2.json';
|
||||
let resources = 'https://resources.download.minecraft.net/';
|
||||
let baselang = 'en_gb';
|
||||
|
||||
urlReq(piston, function (body, res) {
|
||||
json = JSON.parse(body);
|
||||
console.log(
|
||||
`Using base language "${baselang}" from version (${json.versions[0].id})`,
|
||||
);
|
||||
let version = json.versions[0].id; // latest version
|
||||
let resources = 'https://resources.download.minecraft.net/';
|
||||
let baselang = 'en_gb';
|
||||
//let filename = `${baselang} v${version} en_MSE`
|
||||
let filename = `Maoist-Standard-English`;
|
||||
let mcmeta_template = [
|
||||
{
|
||||
text: `§cen_MSE§r\n`,
|
||||
},
|
||||
{
|
||||
text: `§8(§f${baselang}§8)-<§f${version}§8>`,
|
||||
},
|
||||
];
|
||||
|
||||
console.log(`Using base language "${baselang}" from version (${version})`);
|
||||
|
||||
urlReq(json.versions[1].url, function (body, res) {
|
||||
json = JSON.parse(body);
|
||||
@ -67,9 +77,14 @@ urlReq(piston, function (body, res) {
|
||||
console.log(
|
||||
`Translated ${totals.translated} out of ${totals.total} strings`,
|
||||
);
|
||||
|
||||
var mcmeta = __dirname + '/template/pack.mcmeta';
|
||||
var mcmeta_data = JSON.parse(fs.readFileSync(mcmeta));
|
||||
mcmeta_data.pack.description = mcmeta_template;
|
||||
|
||||
fs.writeFileSync(mcmeta, JSON.stringify(mcmeta_data));
|
||||
fs.writeFile(
|
||||
__dirname +
|
||||
'/template/assets/minecraft/lang/en_mse.json',
|
||||
__dirname + '/template/assets/minecraft/lang/en_mse.json',
|
||||
JSON.stringify(pack, null, 4),
|
||||
'utf8',
|
||||
function (err) {
|
||||
@ -78,7 +93,7 @@ urlReq(piston, function (body, res) {
|
||||
'en_mse.json generated, creating pack and compressing.',
|
||||
);
|
||||
const output = fs.createWriteStream(
|
||||
__dirname + '/Maoist-Standard-English.zip',
|
||||
__dirname + `/${filename}.zip`,
|
||||
);
|
||||
const archive = archiver('zip', {
|
||||
zlib: { level: 9 }, // Sets the compression level.
|
||||
@ -90,7 +105,8 @@ urlReq(piston, function (body, res) {
|
||||
console.log(
|
||||
'language-pack archive generated with a filesize of ' +
|
||||
archive.pointer() +
|
||||
' bytes',
|
||||
' bytes' +
|
||||
`\n(./${filename}.zip)`,
|
||||
);
|
||||
});
|
||||
archive.pipe(output);
|
||||
|
Loading…
Reference in New Issue
Block a user