Skip to content

Instantly share code, notes, and snippets.

@wafer-li
Created May 28, 2019 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wafer-li/a8171f4b26829b476e3f37dc22d82bad to your computer and use it in GitHub Desktop.
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.
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