Mcpack Converter ((better)) «Easy»

try: with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf: for root, dirs, files in os.walk(folder_path): for file in files: file_path = Path(root) / file arcname = file_path.relative_to(folder_path) zipf.write(file_path, arcname) print(f"✅ Packed to: {output_path}") return True except Exception as e: print(f"❌ Packing failed: {e}") return False def convert_to_zip(mcpack_path): """Rename .mcpack to .zip""" mcpack_path = Path(mcpack_path) if not mcpack_path.exists(): print(f"❌ File not found: {mcpack_path}") return False

for mcpack in mcpack_files: print(f"\n📦 Processing: {mcpack.name}") extract_mcpack(mcpack, directory / mcpack.stem) def main(): parser = argparse.ArgumentParser(description="MCPack Converter for Minecraft Bedrock") parser.add_argument("path", help="Path to .mcpack file or folder") parser.add_argument("--extract", "-e", action="store_true", help="Extract .mcpack to folder") parser.add_argument("--pack", "-p", action="store_true", help="Pack folder to .mcpack") parser.add_argument("--tozip", "-z", action="store_true", help="Convert .mcpack to .zip (rename only)") parser.add_argument("--tomcpack", "-m", action="store_true", help="Convert .zip to .mcpack (rename only)") parser.add_argument("--extract-all", "-ea", action="store_true", help="Extract all .mcpack files in directory") mcpack converter

try: with zipfile.ZipFile(mcpack_path, 'r') as zip_ref: zip_ref.extractall(output_dir) print(f"✅ Extracted to: {output_dir}") # Try to detect pack type manifest = output_dir / "manifest.json" if manifest.exists(): with open(manifest, 'r') as f: data = json.load(f) modules = data.get("modules", []) if modules: pack_type = modules[0].get("type", "unknown") print(f"📦 Pack type: {pack_type}") return True except Exception as e: print(f"❌ Extraction failed: {e}") return False def pack_to_mcpack(folder_path, output_name=None): """Pack a folder into .mcpack file""" folder_path = Path(folder_path) if not folder_path.exists() or not folder_path.is_dir(): print(f"❌ Folder not found: {folder_path}") return False try: with zipfile

output_dir = Path(output_dir) output_dir.mkdir(exist_ok=True) try: with zipfile.ZipFile(output_path

# Extract a pack python mcpack_converter.py my_skin.mcpack --extract python mcpack_converter.py my_skin_extracted/ --pack Just rename to zip python mcpack_converter.py addon.mcpack --tozip Bulk extract all .mcpack in Downloads folder python mcpack_converter.py ~/Downloads --extract-all 6. Bonus: GUI version (Tkinter) Save as mcpack_gui.py :

import tkinter as tk from tkinter import filedialog, messagebox, scrolledtext import subprocess import sys import os class MCPackConverterGUI: def (self, root): self.root = root root.title("MCPack Converter") root.geometry("600x400")

import os import zipfile import shutil import json import argparse from pathlib import Path def extract_mcpack(mcpack_path, output_dir=None): """Extract .mcpack file to a folder""" mcpack_path = Path(mcpack_path) if not mcpack_path.exists(): print(f"❌ File not found: {mcpack_path}") return False