diff --git a/Better-Leaves-9.1.zip b/Better-Leaves-9.1.zip index 9dc7d3e..2a9a0a8 100644 Binary files a/Better-Leaves-9.1.zip and b/Better-Leaves-9.1.zip differ diff --git a/gen_pack.py b/gen_pack.py index 24158f2..8ea443b 100644 --- a/gen_pack.py +++ b/gen_pack.py @@ -62,6 +62,8 @@ def autoGen(jsonData, args): print("Generating assets...") if (os.path.exists("./assets")): shutil.rmtree("./assets") copy_tree("./base/assets/", "./assets/") + if minify: minifyJsonFiles() + filecount = 0 if (args.programmer): unpackTexturepacks("./input/programmer_art") unpackTexturepacks() @@ -387,6 +389,17 @@ def generateCarpetAssets(carpet): with open(block_model_file, "w") as f: dumpJson(block_model_data, f) +def minifyJsonFiles(rootDir="./assets"): + for root, dirs, files in os.walk(rootDir): + for infile in files: + if infile.endswith(".json"): + minifyExistingJson(root, infile) +def minifyExistingJson(root, infile): + with open(os.path.join(root, infile), "r") as rf: + data = json.load(rf) + with open(os.path.join(root, infile), "w") as wf: + json.dump(data, wf, separators=(',', ':')) + def writeMetadata(args): edition = args.edition if isinstance(edition, list): edition = " ".join(args.edition)