Mcpack Converter May 2026
def run(self, command): path = self.path_var.get() if not path: messagebox.showerror("Error", "Select a file or folder first") return # Call the CLI script script_dir = os.path.dirname(os.path.abspath(__file__)) script_path = os.path.join(script_dir, "mcpack_converter.py") cmd = [sys.executable, script_path, path, command] try: result = subprocess.run(cmd, capture_output=True, text=True) self.log.insert(tk.END, f"\n> {' '.join(cmd)}\n") self.log.insert(tk.END, result.stdout) if result.stderr: self.log.insert(tk.END, result.stderr) self.log.see(tk.END) except Exception as e: messagebox.showerror("Error", str(e)) if == " main ": root = tk.Tk() app = MCPackConverterGUI(root) root.mainloop()
args = parser.parse_args()
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 mcpack converter
tk.Label(root, text="MCPack Converter for Minecraft Bedrock", font=("Arial", 14)).pack(pady=10) # Input frame = tk.Frame(root) frame.pack(pady=5) tk.Label(frame, text="File/Folder:").pack(side=tk.LEFT) self.path_var = tk.StringVar() tk.Entry(frame, textvariable=self.path_var, width=50).pack(side=tk.LEFT, padx=5) tk.Button(frame, text="Browse", command=self.browse).pack(side=tk.LEFT) # Buttons btn_frame = tk.Frame(root) btn_frame.pack(pady=10) tk.Button(btn_frame, text="Extract .mcpack", command=lambda: self.run("--extract")).pack(side=tk.LEFT, padx=5) tk.Button(btn_frame, text="Pack to .mcpack", command=lambda: self.run("--pack")).pack(side=tk.LEFT, padx=5) tk.Button(btn_frame, text="→ .zip", command=lambda: self.run("--tozip")).pack(side=tk.LEFT, padx=5) tk.Button(btn_frame, text="← .mcpack", command=lambda: self.run("--tomcpack")).pack(side=tk.LEFT, padx=5) tk.Button(btn_frame, text="Extract All", command=lambda: self.run("--extract-all")).pack(side=tk.LEFT, padx=5) # Output log self.log = scrolledtext.ScrolledText(root, height=15) self.log.pack(fill=tk.BOTH, expand=True, padx=10, pady=10) def run(self, command): path = self
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.py") cmd = [sys.executable
mcpack_path = zip_path.with_suffix('.mcpack') zip_path.rename(mcpack_path) print(f"✅ Converted to: {mcpack_path}") return True def bulk_extract(directory): """Extract all .mcpack files in a directory""" directory = Path(directory) mcpack_files = list(directory.glob("*.mcpack")) if not mcpack_files: print("❌ No .mcpack files found") return