MineClone2/tools/Texture_Converter.py
teknomunk b582afeb1f Update documentation for Minetest rename to Luanti (#4706)
This updates the VoxeLibre documentation by replacing "Minetest" with "Luanti" and updating links.

Done:
* Update "Minetest" in documentation and comments to "Luanti"
* Update links to forums, ContentDB and Luanti project web page

Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4706
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
2024-11-28 20:55:48 +01:00

43 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# cli.py
import argparse
import sys
from libtextureconverter.gui import main as launch_gui
from libtextureconverter.config import SUPPORTED_MINECRAFT_VERSION, working_dir, appname, home
from libtextureconverter.utils import handle_default_minecraft_texture, find_all_minecraft_resourcepacks
from libtextureconverter.common import convert_resource_packs
def main():
make_texture_pack = True
parser = argparse.ArgumentParser(description=f"This is the official VoxeLibre Texture Converter. This will convert textures from Minecraft resource packs to a Luanti texture pack. Supported Minecraft version: {SUPPORTED_MINECRAFT_VERSION} (Java Edition)")
parser.add_argument("-i", "--input", help="Directory of Minecraft resource pack to convert")
parser.add_argument("-o", "--output", default=working_dir, help="Directory in which to put the resulting Luanti texture pack")
parser.add_argument("-p", "--pixel-size", type=int, help="Size (in pixels) of the original textures")
parser.add_argument("-d", "--dry-run", action="store_true", help="Pretend to convert textures without changing any files")
parser.add_argument("-v", "--verbose", action="store_true", help="Print out all copying actions")
parser.add_argument("-def", "--default", action="store_true", help="Use the default Minecraft texture pack")
parser.add_argument("-a", "--all", action="store_true", help="Convert all known Minecraft texturepacks")
args = parser.parse_args()
if len(sys.argv) == 1:
launch_gui()
else:
resource_packs = []
if args.default:
resource_packs.append(handle_default_minecraft_texture(home, args.output))
elif args.all:
resource_packs.extend(find_all_minecraft_resourcepacks())
elif args.input:
resource_packs.append(args.input)
if not resource_packs:
print(f"ERROR: No valid resource packs specified. Use '{appname} -h' for help.")
sys.exit(2)
convert_resource_packs(resource_packs, args.output, args.pixel_size, args.dry_run, args.verbose, make_texture_pack)
if __name__ == "__main__":
main()