Created
October 26, 2025 22:36
-
-
Save Azvyl/ee7e467cf18e41936331053394598485 to your computer and use it in GitHub Desktop.
Fix white/blank Ore UI icon in Minecraft
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 glob | |
| # The directory where the files are located. | |
| # We will use the absolute path you provided. | |
| BASE_PATH = r"D:\DavyCraft648\Minecraft\MCLauncher\Minecraft-1.21.114.1\data\gui\dist\hbui\assets" | |
| ENCODED_STRING = "%40" | |
| DECODED_STRING = "@" | |
| def fix_url_encoded_filenames(base_dir: str): | |
| """ | |
| Scans a directory for filenames containing '%40' and renames them by | |
| replacing '%40' with '@'. | |
| """ | |
| if not os.path.exists(base_dir): | |
| print(f"Error: Base directory not found at: {base_dir}") | |
| print("Please verify the value of the BASE_PATH variable in the script.") | |
| return | |
| search_pattern = os.path.join(base_dir, '*') | |
| all_files = glob.glob(search_pattern) | |
| files_to_rename = [f for f in all_files if ENCODED_STRING in os.path.basename(f)] | |
| print(f"Scanning directory: {base_dir}") | |
| print(f"Found {len(files_to_rename)} files to rename (containing '{ENCODED_STRING}').") | |
| if not files_to_rename: | |
| print("No files found requiring renaming. The process is complete or files are already fixed.") | |
| return | |
| for old_filepath in files_to_rename: | |
| old_filename = os.path.basename(old_filepath) | |
| new_filename = old_filename.replace(ENCODED_STRING, DECODED_STRING) | |
| new_filepath = os.path.join(base_dir, new_filename) | |
| if old_filename == new_filename: | |
| print(f"Skipping: '{old_filename}' - No change needed.") | |
| continue | |
| try: | |
| os.rename(old_filepath, new_filepath) | |
| print(f"Success: '{old_filename}' -> '{new_filename}'") | |
| except PermissionError: | |
| print(f"Failed: Permission denied to rename '{old_filename}'.") | |
| except Exception as e: | |
| print(f"Failed to rename '{old_filename}': {e}") | |
| print("\nFile renaming process completed.") | |
| if __name__ == "__main__": | |
| fix_url_encoded_filenames(BASE_PATH) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment