Last active
February 25, 2026 18:36
-
-
Save ambiennt/4eba1e43414bcfcfb5c1948a2a7c5db6 to your computer and use it in GitHub Desktop.
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 json | |
| import shutil | |
| from pathlib import Path | |
| BASE_DIRS = [ | |
| Path(os.getenv("LOCALAPPDATA")) / "Packages" / "Microsoft.MinecraftUWP_8wekyb3d8bbwe" / "LocalCache" / "minecraftpe" / "packcache" / "resource", # UWP | |
| Path(os.getenv("LOCALAPPDATA")) / "Temp" / "minecraftpe" / "packcache" / "resource", # GDK | |
| Path(os.getenv("LOCALAPPDATA")) / "Temp" / "Minecraft Bedrock" / "minecraftpe" / "packcache" / "resource", # GDK, 26.0+ ? | |
| ] | |
| MANIFEST_TARGET_AUTHOR = "CubeCraft" | |
| MANIFEST_TARGET_NAME = "Cubecraft Costumes" | |
| PRESERVE_ROOT_FILES = {"manifest.json", "pack_icon.png"} | |
| def delete_directory_contents_except_root_files(root: Path, preserve_files): | |
| for item in root.iterdir(): | |
| if item.name not in preserve_files: | |
| try: | |
| if item.is_file(): | |
| item.unlink() | |
| print(f"Deleted file: {item}") | |
| elif item.is_dir(): | |
| shutil.rmtree(item) | |
| print(f"Deleted directory: {item}") | |
| except Exception as e: | |
| print(f"Error deleting {item}: {e}") | |
| def process_base_directory(base_dir: Path): | |
| if not base_dir.exists(): | |
| print(f"Resource pack directory not found: {base_dir}") | |
| return | |
| for subdir in base_dir.iterdir(): | |
| if subdir.is_dir(): | |
| manifest_path = subdir / "manifest.json" | |
| if manifest_path.exists(): | |
| try: | |
| with manifest_path.open('r', encoding='utf-8') as f: | |
| data = json.load(f) | |
| authors = data.get("metadata", {}).get("authors", []) | |
| name = data.get("header", {}).get("name", "") | |
| if MANIFEST_TARGET_AUTHOR in authors and name == MANIFEST_TARGET_NAME: | |
| print(f"Found CubeCraft cosmetics pack at {subdir}, disabling...") | |
| delete_directory_contents_except_root_files(subdir, PRESERVE_ROOT_FILES) | |
| except Exception as e: | |
| print(f"Could not read manifest.json in {subdir}: {e}") | |
| def main(): | |
| for base_dir in BASE_DIRS: | |
| print(f"Scanning: {base_dir}") | |
| process_base_directory(base_dir) | |
| print("Done.") | |
| input("Press Enter to continue...") | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment