Dense Grit Sand added. Variant Slab compat fix. Build system updated.

This commit is contained in:
stfwi 2020-05-09 14:25:11 +02:00
parent 4c2755d915
commit 741b266efc
114 changed files with 1966 additions and 2653 deletions

View file

@ -9,7 +9,9 @@
c.gradle_property_version_minecraft = function() { return "version_minecraft"; }
c.gradle_property_version_forge = function() { return "version_forge"; }
c.project_download_inet_page = function() { return "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/"; }
c.options = {}; // don't freeze that
c.options = {
// without_ref_repository_check: true
};
c.languages = {
"en_us": { code:"en_us", name:"English", region:"United States" },
"de_de": { code:"de_de", name:"German", region:"Germany" },

View file

@ -1,127 +0,0 @@
"use strict";
(function(constants){
var me = {};
/**
* Determines a list of all textures in the given path as plain object,
* where the keys are the unified texture path (e.g. "block/", not "blocks/"),
* and the value an object containing file path, SHA1, size, etc.
* @returns {object}
*/
me.load_texture_data = function(textures_path) {
const wd = fs.cwd();
var data = {};
try {
if(!fs.chdir(textures_path)) throw new Error("Texture root path does not exist: '" + textures_path + "'");
fs.find(".", '*.*', function(path) {
const file = path.replace(/[\\]/g, "/").replace(/^\.\//,"");
const unified_file = file.replace(/^blocks\//, "block/");
data[unified_file] = { path:file, size:fs.size(file), sha:sys.hash.sha1(path, true) };
return false;
});
return data;
} finally {
fs.chdir(wd);
}
}
/**
* Compares texture files and mcdata files two given assets paths, returns the
* lists of both file trees and the differences as object.
* @returns {object}
*/
me.compare_textures = function(assets_path_a, assets_path_b) {
const txpath_a = assets_path_a + "/" + constants.mod_registry_name() + "/textures";
const txpath_b = assets_path_b + "/" + constants.mod_registry_name() + "/textures";
const a = me.load_texture_data(txpath_a);
const b = me.load_texture_data(txpath_b);
const txpath_a_is112 = fs.isdir(txpath_a + "/blocks");
const txpath_b_is112 = fs.isdir(txpath_b + "/blocks");
const cmp = {a:{},b:{}};
cmp.a.path = txpath_a;
cmp.b.path = txpath_b;
cmp.a.is112 = txpath_a_is112;
cmp.b.is112 = txpath_b_is112;
cmp.a.files = Object.assign({},a);
cmp.b.files = Object.assign({},b);
cmp.match = {}
cmp.differ = {}
cmp.onlyin_a = {}
cmp.onlyin_b = {}
for(var key in a) {
if(b[key] === undefined) {
cmp.onlyin_a[key] = a[key];
continue;
}
if(a[key].sha === b[key].sha) {
cmp.match[key] = a[key];
b[key]=undefined; delete b[key];
} else {
cmp.differ[key] = { a:a[key], b:b[key] };
b[key]=undefined; delete b[key];
}
}
a = undefined;
for(var key in b) {
cmp.onlyin_b[key] = b[key];
}
b = undefined;
return cmp;
};
/**
* Loads all blockstate files in the given assets path, and returns the parsed JSON
* data as plain object, where the keys are the blockstate names, and the value the
* parsed JSON files.
* @returns {object}
*/
me.load_blockstates = function(assets_path) {
const wd = fs.cwd();
var data = {};
try {
if(!fs.chdir(assets_path+"/blockstates")) throw new Error("blockstates path not found in: '" + assets_path + "'");
fs.find(".", '*.json', function(path) {
const file = path.replace(/[\\]/g, "/").replace(/^\.\//,"");
if(fs.basename(file) != fs.basename(file).toLowerCase()) throw new Error("Blockstate file must be lowercase: '"+file+"'"); // hard fail
const blockstate_name = fs.basename(file).replace(/[\.]json/i, "");
if(blockstate_name.search(/[^a-z0-9_]/) >= 0) throw new Error("Blockstate file name contains invalid characters: '"+file+"'"); // here, too
var json = fs.readfile(path);
if(json===undefined) throw new Error("Failed to read blockstate file '"+file+"' (could not open file)");
try { json=JSON.parse(json); } catch(ex) { throw new Error("Failed to parse blockstate file '"+file+"' (invalid JSON)"); }
data[blockstate_name] = {file:(assets_path+"/blockstates/"+file), data:json};
return false;
});
return data;
} finally {
fs.chdir(wd);
}
};
me.compare_blockstates = function(assets_path_a, assets_path_b) {
const a = me.load_blockstates(assets_path_a);
const b = me.load_blockstates(assets_path_b);
const onlyin_a = {};
const onlyin_b = {};
for(var key in a) {
if(b[key] === undefined) {
onlyin_a[key] = a[key];
continue;
} else {
b[key]=undefined; delete b[key];
}
}
a = undefined;
for(var key in b) {
onlyin_b[key] = b[key];
}
b = undefined;
return {
onlyin_a: onlyin_a,
onlyin_b: onlyin_b,
}
};
Object.freeze(me);
return me;
});

View file

@ -2,6 +2,8 @@
(function(constants){
var me = {};
const clone = function(o) { return JSON.parse(JSON.stringify(o)); }
/**
* Loads the raw data of the lang file.
* @returns {object}
@ -115,8 +117,76 @@
* Applies to the CWD and 1.12.2 lang files.
* @returns {void}
*/
me.sync_languages = function(reflang_code) {};
me.sync_languages = function(reflang_code) {
const modid = constants.mod_registry_name();
if(reflang_code===undefined) reflang_code = "en_us";
reflang_code = reflang_code.trim().toLowerCase();
function load() {
const lang_data = {};
fs.find("./src/main/resources/assets/"+ modid +"/lang", '*.json', function(f){
const r = me.load_raw(f);
lang_data[r.code] = r.data;
return false;
});
return lang_data;
}
function sync_lang_data(lang_data, reflang_code) {
const lang_outputs = clone(lang_data);
const reflang = lang_data[reflang_code];
for(var name in lang_data) {
if(name == reflang_code) continue;
const lang = lang_outputs[name];
for(var key in reflang) {
if(lang[key] === undefined) {
lang[key] = clone(reflang[key]);
print("[warn] Lang: Added default language for missing entry in " + name + ": '" + key + "'");
}
}
for(var key in lang) {
if((reflang[key] === undefined) && (lang[key].search(/^_/)<0)) {
lang["_"+key] = lang[key];
print("[warn] Lang: Commented out obsolete entry in " + name + ": '" + key + "'");
}
}
}
return lang_outputs;
}
const sort_entries = function(data) {
data = clone(data);
const out = {};
const move = function(key) { out[key] = data[key]; data[key] = undefined; delete data[key]; };
move("language");
move("language.code");
move("language.region");
move("itemGroup.tab"+modid);
move(modid+".config.title");
const keys = Object.keys(data);
keys.sort(function(a, b) {
if((a.search(modid+".config.")==0) && (b.search(modid+".config.")<0) ) return -1;
if((b.search(modid+".config.")==0) && (a.search(modid+".config.")<0) ) return +1;
if((a.search(modid+".tooltip.")==0) && (b.search(modid+".tooltip.")<0) ) return -1;
if((b.search(modid+".tooltip.")==0) && (a.search(modid+".tooltip.")<0) ) return +1;
if((a.search("block."+modid+".")==0) && (b.search("block."+modid+".")<0) ) return -1;
if((b.search("block."+modid+".")==0) && (a.search("block."+modid+".")<0) ) return +1;
if((a.search("item."+modid+".")==0) && (b.search("item."+modid+".")<0) ) return -1;
if((b.search("item."+modid+".")==0) && (a.search("item."+modid+".")<0) ) return +1;
return (a>b ? 1 : (a<b ? -1 : 0));
});
for(var i in keys) move(keys[i]);
return out;
};
const output_data = sync_lang_data(load(), reflang_code);
for(var name in output_data) {
var data = sort_entries(output_data[name]);
data = JSON.stringify(data, null, 2);
fs.writefile("./src/main/resources/assets/" + modid + "/lang/" + name + ".json", data);
// print("--------------------------------------------------------------------------------");
// print(output_data[name]);
}
};
Object.freeze(me);
return me;
});
});

View file

@ -1,401 +0,0 @@
#!/usr/bin/djs
"use strict";
(function(constants, libassets, liblang){
const me = {'tasks':{}, 'parsing':{},'sanatizing':{}};
const note = function() {
var args = ["[note]"];
for(var i in arguments) args.push(arguments[i]);
print.apply(this, args);
}
const warn = function() {
var args = ["[warn]"];
for(var i in arguments) args.push(arguments[i]);
print.apply(this, args);
}
const pass = function() {
var args = ["[pass]"];
for(var i in arguments) args.push(arguments[i]);
print.apply(this, args);
}
const fail = function() {
var args = ["[fail]"];
for(var i in arguments) args.push(arguments[i]);
print.apply(this, args);
}
me.tasks.map_regnames_blockstate_filenames = function() {
const cwd = fs.cwd();
const rnmap = constants.registryname_map_112_114;
if(rnmap === undefined) {
note("Blockstate file renaming skipped, no mapping defined.");
return;
}
try {
if(!fs.chdir(constants.local_assets_root()+"/blockstates")) throw new Error("Failed to switch to blockstates dir.");
for(var oldname in rnmap) {
const oldfile = oldname+".json";
const newfile = rnmap[oldname]+".json";
if(oldfile==newfile) continue;
if(fs.isfile(oldname+".json")) {
if(fs.isfile(newfile)) {
note("blockstate file skipped: '" + oldfile + "' -> '" + newfile + "' (new file already exists)");
} else if(!fs.rename(oldfile, newfile)) {
note("blockstate file rename failed: '" + oldfile + "' -> '" + newfile + "'");
} else {
note("blockstate file: '" + oldfile + "' -> '" + newfile + "'");
}
}
}
pass("Blockstate file renaming done.");
} catch(ex) {
fail("Blockstate file renaming failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.map_regnames_lang_file_keys = function() {
const cwd = fs.cwd();
const rnmap = constants.registryname_map_112_114;
const block_prefix = "block." + constants.modid + ".";
const item_prefix = "item." + constants.modid + ".";
try {
if(!fs.chdir(constants.local_assets_root()+"/lang")) throw new Error("Failed to switch to lang dir.");
const langfiles = fs.readdir();
for(var i_langfile in langfiles) {
const original_lang = JSON.parse(fs.readfile(langfiles[i_langfile]));
const replaced_lang = {}
for(var key in original_lang) {
if(key.search(block_prefix)===0) {
const regname = key.replace(block_prefix,"").replace(/[\.].*$/,"");
if(rnmap[regname] !== undefined) {
const sfind = block_prefix + regname;
const srepl = block_prefix + rnmap[regname];
const newkey = key.replace(sfind, srepl);
replaced_lang[newkey] = original_lang[key];
continue;
}
} else if(key.search(item_prefix)===0) {
const regname = key.replace(item_prefix,"").replace(/[\.].*$/,"");
if(rnmap[regname] !== undefined) {
const sfind = item_prefix + regname;
const srepl = item_prefix + rnmap[regname];
const newkey = key.replace(sfind, srepl);
replaced_lang[newkey] = original_lang[key];
continue;
}
}
// replacements must continue
replaced_lang[key] = original_lang[key];
}
fs.writefile(langfiles[i_langfile], JSON.stringify(replaced_lang,null,1));
}
pass("Lang file key mappings done.");
} catch(ex) {
warn("Lang file key mapping failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.patch_texture_paths_in_models = function() {
const cwd = fs.cwd();
const replacements = {};
replacements['"' + constants.modid+":blocks/"] = '"' + constants.modid+":block/"
try {
if(!fs.chdir(constants.local_assets_root()+"/models")) throw new Error("Failed to switch to models dir.");
fs.find(".", "*.json", function(path){
const original_text = fs.readfile(path);
var replaced_text = ""+original_text;
JSON.parse(replaced_text); // to throw on load error
for(var sfind in replacements) replaced_text = replaced_text.split(sfind).join(replacements[sfind]);
if(replaced_text !== original_text) {
note("Replacements in model '"+path+"'");
fs.writefile(path, replaced_text);
}
return false;
});
pass("Model file texture paths done.");
} catch(ex) {
fail("Model file texture paths failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.create_missing_block_items = function() {
const cwd = fs.cwd();
const blockstate_models = {};
try {
if(!fs.chdir(constants.local_assets_root())) throw new Error("Failed to switch to assets dir.");
fs.find("blockstates", "*.json", function(path){
const blockstate = fs.basename(path).replace(".json","");
const json = JSON.parse(fs.readfile(path));
if(json["forge_marker"] !== undefined) {
var model = json["defaults"]["model"];
if(model.search(constants.modid+":block/") < 0) {
model = model.replace(constants.modid+":", constants.modid+":block/");
}
blockstate_models[blockstate] = model;
}
if(blockstate_models[blockstate] === undefined) {
throw new Error("IMPLEMENT use first found model.");
}
return false;
});
for(var blockstate in blockstate_models) {
const item_model_file = "models/item/"+blockstate+".json";
if(fs.isfile(item_model_file)) continue;
if(!fs.writefile(item_model_file, JSON.stringify({parent:blockstate_models[blockstate]}))) {
throw new Error("Failed to write item model file '" + item_model_file + "'");
}
}
pass("Missing item models done.");
} catch(ex) {
fail("Missing item models failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.patch_registry_names_in_java_files = function() {
const cwd = fs.cwd();
const rnmap = constants.registryname_map_112_114;
if(rnmap === undefined) {
pass("Registry name mapping in java files skipped, no mappings defined.");
return;
}
try {
if(!fs.chdir("src/main/java")) throw new Error("Failed to switch to 'src/main/java'.");
fs.find(".", "*.java", function(path){
const original_code = fs.readfile(path);
var replaced_code = ""+original_code;
if(original_code===undefined) throw new Error("Failed to read '"+ path +"'.");
for(var oldname in rnmap) {
if(oldname == rnmap[oldname]) {
continue;
}
{
const sfind = '"'+constants.modid+':'+oldname+'"';
const srepl = '"'+constants.modid+':'+rnmap[oldname]+'"';
if(replaced_code.search(sfind) >= 0) {
replaced_code = replaced_code.split(sfind).join(srepl);
note(fs.basename(path), ":", sfind, "->" , srepl);
}
}
{
const sfind = '"'+oldname+'"';
const srepl = '"'+rnmap[oldname]+'"';
if(replaced_code.search(sfind) >= 0) {
replaced_code = replaced_code.split(sfind).join(srepl);
note(fs.basename(path), ":", sfind, "->" , srepl);
}
}
}
if(replaced_code !== original_code) {
if(!fs.writefile(path, replaced_code)) throw new Error("Failed to write '"+ path +"'.");
}
return false;
});
pass("Registry name mapping in java files patched.");
} catch(ex) {
fail("Registry name mapping in java files failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.patch_forge_blockstates = function() {
const cwd = fs.cwd();
try {
if(!fs.chdir(constants.local_assets_root()+"/blockstates")) throw new Error("Failed to switch to blockstates dir.");
const blockstate_files = fs.readdir(".");
for(var fit in blockstate_files) {
const jtxt = fs.readfile(blockstate_files[fit]);
if(!jtxt) throw new Error("Failed read blockstate file '" + blockstate_files[fit] + "'.");
const json = JSON.parse(jtxt);
if(json["forge_marker"] !== 1) continue;
// now simply text replace to keep the formatting
var njtext = jtxt.replace(/"normal"[\s]*:/, '"":');
njtext = njtext.replace(/"inventory"[\s]*:[\s]*\[[\s]*\{[\s]*\}[\s]*][\s]*[,]?[\s]*/, '');
njtext = njtext.replace(/"model":[\s]*"/g, '"model": "');
const pref = '"model": "' + constants.modid + ':';
njtext = njtext.replace(new RegExp(pref, "g"), pref + 'block/'); // actually faster to simply replace all and correct doubles.
njtext = njtext.replace(new RegExp(pref + 'block/block/', "g"), pref + 'block/');
njtext = njtext.replace("\n\n", "\n");
if(jtxt !== njtext) {
fs.writefile(blockstate_files[fit], njtext);
note("Forge blockstate '"+ fs.basename(blockstate_files[fit]) +"' patched.");
}
}
pass("Forge blockstates patched.");
} catch(ex) {
fail("Forge blockstate patching failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.map_recipe_filenames = function() {
const cwd = fs.cwd();
const rnmap = constants.registryname_map_112_114;
if(rnmap === undefined) {
pass("Recipe file name mapping skipped, no mappings defined.");
return;
}
try {
if(!fs.chdir(constants.local_data_root()+"/recipes")) throw new Error("Failed to switch to recipes dir.");
fs.find(".", "*.json", function(path){
const file_name = fs.basename(path);
if(file_name.search("_")===0) return;
const oldfile = path;
var newfile = "";
for(var oldname in rnmap) {
const newname = rnmap[oldname];
if(file_name.search(oldname)===0) {
newfile = fs.dirname(path) + "/" + fs.basename(path).replace(oldname, newname);
newfile = newfile.replace(".json","");
if((newfile.search(/_recipe$/)<0) && (newfile.search(/_backcycle$/)<0) && (newfile.search(/_standalone$/)<0)) {
newfile += "_recipe";
}
newfile += ".json";
break;
}
}
if(newfile == "") {
// no match
} else if(oldfile === newfile) {
note("skip identical file " + newfile);
} else {
note(oldfile + " -> " + newfile);
fs.rename(oldfile, newfile);
}
});
pass("Recipe file name mapping done.");
} catch(ex) {
fail("Recipe file name mapping failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.map_recipe_contents = function() {
const modid = constants.modid;
const cwd = fs.cwd();
const rnmap = constants.registryname_map_112_114;
if(rnmap === undefined) {
pass("Recipe json data mapping skipped, no mappings defined.");
return;
}
try {
if(!fs.chdir(constants.local_data_root()+"/recipes")) throw new Error("Failed to switch to recipes dir.");
fs.find(".", "*.json", function(path){
if(fs.basename(path).search("_")===0) return;
const txt = fs.readfile(path);
if(txt === undefined) {
note("Failed to read file '" + path + "'");
return;
}
// The easy stuff fist, text replace regnames
for(var key in rnmap) {
const oldname = modid+":"+key
const newname = modid+":"+rnmap[key];
txt = txt.split('"'+oldname+'"').join('"'+newname+'"');
}
txt = JSON.stringify(JSON.parse(txt));
txt = txt.replace(/,"data":0/g, "");
var recipe = JSON.parse(txt);
if(recipe.conditions === undefined) recipe.conditions = {};
recipe.conditions.type = modid+":grc"
recipe.conditions.result = recipe.result;
fs.writefile(path, JSON.stringify(recipe,null,1));
if((recipe.result===undefined) || (recipe.result.item===undefined)) {
warn("Recipe '" + path + "': No result item?!");
return;
}
const filename_check = recipe.result.item.replace(/^.*?:/,"");
if(fs.basename(path).search(filename_check) < 0) {
warn("Recipe filename '" + path + "' does not contain the result '"+ filename_check +"'.");
//const newfile = fs.dirname(path) + "/" + filename_check + "_recipe.json";
//if(!fs.isfile(newfile)) fs.rename(path, newfile);
}
});
pass("Recipe json data mappings done.");
} catch(ex) {
fail("Recipe json data mappings failed:"+ex);
} finally {
fs.chdir(cwd);
}
};
me.tasks.lang_json_text_replacements = function() {
var file_list = (function() {
var ls = [];
const dir = "./" + constants.local_assets_root() + "/lang";
if(fs.isdir(dir)) {
ls = ls.concat(fs.find(dir, '*.json'));
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
}
ls.sort();
return ls;
})();
for(var file_i in file_list) {
var file = file_list[file_i];
var txt = fs.readfile(file);
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
txt = txt.replace(/\\\\n/g,"\\n");
fs.writefile(file, txt);
}
};
me.stdtasks = {};
me.stdtasks["assets"] = function() {
me.tasks.map_regnames_blockstate_filenames();
me.tasks.patch_texture_paths_in_models();
me.tasks.create_missing_block_items();
me.tasks.patch_registry_names_in_java_files();
me.tasks.patch_forge_blockstates();
me.tasks.map_recipe_filenames();
me.tasks.map_recipe_contents();
me.tasks.map_regnames_lang_file_keys();
};
me.stdtasks["datagen"] = function() {
sys.exec("gradlew.bat", ["--no-daemon", "runData"]);
// double check and really only copy json files.
const dst = fs.realpath("src/main/resources/data/" + constants.modid);
const src = fs.realpath("src/generated/resources/data/" + constants.modid);
if(!dst || !src) throw "Source or destination directory not found.";
const src_files = fs.find(src, "*.json");
const upath = function(s) { return s.replace(/[\\]/g,"/").replace(/^[\/]/,""); } // for correct display on win32
if(src_files===undefined) return 1;
for(var i in src_files) {
const srcfile = src_files[i];
const dstfile = srcfile.replace(src, dst);
const dstdir = fs.dirname(dstfile);
if(!fs.isdir(dstdir)) fs.mkdir(dstdir);
if(!fs.isfile(dstfile)) {
print("[copy] ", upath(srcfile.replace(src,"")));
fs.copy(srcfile, dstdir);
} else if(sys.hash.sha1(srcfile,true) != sys.hash.sha1(dstfile,true)) {
print("[edit] ", upath(srcfile.replace(src,"")));
fs.unlink(dstfile);
fs.copy(srcfile, dstdir);
}
}
};
me.stdtasks["lang-json-fixes"] = function() {
me.tasks.lang_json_text_replacements();
}
Object.freeze(me);
Object.freeze(me.tasks);
Object.freeze(me.parsing);
Object.freeze(me.sanatizing);
return me;
});

View file

@ -3,6 +3,11 @@
"use strict";
(function(constants){
const note = function() { var args = ["[note]"]; for(var i in arguments) args.push(arguments[i]); print.apply(this, args); }
const warn = function() { var args = ["[warn]"]; for(var i in arguments) args.push(arguments[i]); print.apply(this, args); }
const pass = function() { var args = ["[pass]"]; for(var i in arguments) args.push(arguments[i]); print.apply(this, args); }
const fail = function() { var args = ["[fail]"]; for(var i in arguments) args.push(arguments[i]); print.apply(this, args); }
const me = {'tasks':{}, 'parsing':{},'sanatizing':{}};
/**
@ -180,6 +185,29 @@
}
};
/**
* Fixes "\\n" to "\n" in lang json files.
*/
me.sanatizing.lang_json_newline_fixes = function() {
var file_list = (function() {
var ls = [];
const dir = "./" + constants.local_assets_root() + "/lang";
if(fs.isdir(dir)) {
ls = ls.concat(fs.find(dir, '*.json'));
for(var i in ls) ls[i] = ls[i].replace(/\\/g,"/");
}
ls.sort();
return ls;
})();
for(var file_i in file_list) {
var file = file_list[file_i];
var txt = fs.readfile(file);
if(txt===undefined) throw new Error("Failed to read '" + file + "'");
txt = txt.replace(/\\\\n/g,"\\n");
fs.writefile(file, txt);
}
};
/**
* Checks the versions specified in the gradle.properties against
* the last readme.md changelog version. Applies to the CWD.
@ -336,15 +364,10 @@
const html = "<pre>\n" + (hist.replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;")) + "\n</pre>";
fs.writefile("dist/" + modid + "-" + version + ".html", html);
};
stdtasks["tabs-to-spaces"] = function() {
me.sanatizing.tabs_to_spaces(['java','lang']);
};
stdtasks["trailing-whitespaces"] = function() {
me.sanatizing.remove_trailing_whitespaces(['java','json','lang']);
};
stdtasks["sanatize"] = function() {
stdtasks["trailing-whitespaces"]();
stdtasks["tabs-to-spaces"]();
me.sanatizing.remove_trailing_whitespaces(['java','json','lang']);
me.sanatizing.tabs_to_spaces(['java','lang']);
me.sanatizing.lang_json_newline_fixes();
}
stdtasks["dist"] = function() {
stdtasks["version-html"]();
@ -355,7 +378,6 @@
fs.mkdir("./meta");
fs.writefile("./meta/update.json", JSON.stringify(json, null, 2));
};
stdtasks["dump-languages"] = function() {
const lang_version = (me.parsing.gradle_properties("gradle.properties").version_minecraft.search("1.12.")==0) ? "1.12" : "1.13";
const lang_extension = (lang_version == "1.12") ? ("lang") : ("json");
@ -369,7 +391,34 @@
});
print(JSON.stringify(lang_files,null,1));
};
stdtasks["datagen"] = function() {
sys.exec("gradlew.bat", ["--no-daemon", "runData"]);
// double check and really only copy json files.
const dst = fs.realpath("src/main/resources/data/" + constants.modid);
const src = fs.realpath("src/generated/resources/data/" + constants.modid);
if(!dst || !src) throw "Source or destination directory not found.";
const src_files = fs.find(src, "*.json");
const upath = function(s) { return s.replace(/[\\]/g,"/").replace(/^[\/]/,""); } // for correct display on win32
if(src_files===undefined) return 1;
for(var i in src_files) {
const srcfile = src_files[i];
const dstfile = srcfile.replace(src, dst);
const dstdir = fs.dirname(dstfile);
if(!fs.isdir(dstdir)) fs.mkdir(dstdir);
if(!fs.isfile(dstfile)) {
print("[copy] ", upath(srcfile.replace(src,"")));
fs.copy(srcfile, dstdir);
} else if(sys.hash.sha1(srcfile,true) != sys.hash.sha1(dstfile,true)) {
print("[edit] ", upath(srcfile.replace(src,"")));
fs.unlink(dstfile);
fs.copy(srcfile, dstdir);
}
}
};
stdtasks["sync-languages"] = function() {
const liblang = include( (me.parsing.version_data().minecraft == "1.12.2") ? ("../meta/lib/liblang.1.12.js") : ("../meta/lib/liblang.1.13.js"))(constants);
liblang.sync_languages();
};
/**
* Task main

View file

@ -1,14 +1,15 @@
{
"homepage": "https://www.curseforge.com/minecraft/mc-mods/engineers-decor/",
"promos": {
"1.12.2-recommended": "1.0.19",
"1.12.2-latest": "1.0.20-b6",
"1.12.2-recommended": "1.0.20",
"1.12.2-latest": "1.0.20",
"1.14.4-recommended": "",
"1.14.4-latest": "1.0.20-b6",
"1.15.2-recommended": "",
"1.15.2-latest": "1.0.20-b6"
},
"1.12.2": {
"1.0.20": "[R] Release based on v1.0.20-b6. Release-to-release changes: * Manual back ported. * Steel Mesh Fence Gate back ported. * E-Furnace speed selection switch back ported. * Labeled Crate back ported. * Minor bug fixes, compatibility changes.",
"1.0.20-b6": "[F] Implemented compat related to issue #91.",
"1.0.20-b5": "[A] Back-ported Patchouli based Manual (you need to install Vazkii_'s Patchouli, too).\n[A] Back-ported Steel Mesh Fence Gate.\n[M] Minor back-porting compatibility refractoring.",
"1.0.20-b4": "[F] Fixed TE registration bug for Crate registry-optout (issue #91, thx tyon2006).",