Created
May 28, 2019 17:41
-
-
Save wafer-li/a8171f4b26829b476e3f37dc22d82bad to your computer and use it in GitHub Desktop.
Soartex-Modded texture pack script. Use it in the root of Soartex-Modded-1-12-2 and it will pack all mods's textures into one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import zipfile | |
zip_file = zipfile.ZipFile('Soartex-Modded-1-12-2.zip', 'w', zipfile.ZIP_DEFLATED) | |
for root,dirs,files in os.walk('.'): | |
relative_path = root[2:] | |
if relative_path.count(os.sep) > 1: # root == App/asserts/lowcase | |
for f in files: | |
zip_file.write(os.path.join(root, f), os.path.join(relative_path[relative_path.find(os.sep)+1:], f)) | |
meta_filename = 'pack.mcmeta' | |
meta_content = ''' | |
{ | |
"pack": { | |
"pack_format": 3, | |
"description": "Soartex-Modded 1.12.2 Textture Pack" | |
} | |
} | |
''' | |
with open(meta_filename, 'w') as f: | |
f.write(meta_content) | |
zip_file.write(meta_filename) | |
os.remove(meta_filename) | |
zip_file.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment