Last active
March 28, 2026 09:38
-
-
Save faizul726/f02cd5a6e71799a729e7a7f752f40403 to your computer and use it in GitHub Desktop.
Installer script for Mirai Shader for Minecraft Bedrock Edition
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
| :: by github.com/faizul726 | |
| :: for Mirai Shader by bambosan | |
| :: on 20260306 | |
| @echo off | |
| setlocal enabledelayedexpansion | |
| cls | |
| pushd "%~dp0" | |
| :: Uncomment to see what's being executed | |
| :: It will pause so you have to press any key again and again to execute each command | |
| :: set "DEBUG=true" | |
| :: Uncomment to copy/delete files in <pack_root>\reflection_configs\lods | |
| :: set "CONSIDER_LODS_FILES=true" | |
| :: Colors and thingies | |
| set "ESC=[" | |
| set "GRY=[90m" | |
| set "RED=[91m" | |
| set "GRN=[92m" | |
| set "YLW=[93m" | |
| set "BLU=[94m" | |
| set "CYN=[96m" | |
| set "WHT=[97m" | |
| set "RST=[0m" | |
| set "ERR=[41;97m" | |
| set "PACK_ROOT=pack" | |
| :: Get Minecraft location | |
| echo !YLW![*] Getting Minecraft location...!RST! | |
| for /f "tokens=*" %%P in ('powershell -NoProfile -Command "(Get-AppxPackage -Name Microsoft.MinecraftUWP).InstallLocation"') do (set "MCLOCATION=%%P") | |
| if not defined MCLOCATION ( | |
| cls | |
| echo !ERR![^^!] You don't have Minecraft installed!RST! | |
| echo !GRY! Press any key to exit...!RST! | |
| pause >nul | |
| exit 1 | |
| ) | |
| :HOME | |
| cls | |
| echo !WHT!Mirai Install Script!RST! | |
| echo !GRY!Not for dumb people!RST! | |
| echo !GRY!Note: Script has no proper error checks!RST! | |
| echo. | |
| echo !YLW!What do you want to do?!RST! | |
| echo !GRN![1] Install!RST! | |
| echo !RED![2] Uninstall!RST! | |
| echo. | |
| echo !RED![B] Exit!RST! | |
| echo. | |
| echo !YLW!Press corresponding key to confirm your choice...!RST! | |
| choice /c 12b /n >nul | |
| goto option-!errorlevel! | |
| goto HOME | |
| :: Install | |
| :option-1 | |
| cls | |
| if exist "src\" if exist "!PACK_ROOT!\" ( | |
| echo !YLW![?] Mirai source code found in current folder | |
| echo Use script as companion for source code?!RST! | |
| echo. | |
| echo !GRN![Y] Yes !RED![N] No [B] Go back!RST! | |
| choice /c ynb /n >nul | |
| if !errorlevel! equ 3 goto HOME | |
| if !errorlevel! equ 1 goto manifestFound | |
| ) | |
| cls | |
| echo !YLW![?] How to install?!RST! | |
| echo. | |
| echo !WHT![1] Download MCPACK from web!RST! | |
| echo !WHT![2] Set path to MCPACK!RST! | |
| echo !RED![B] Go back!RST! | |
| choice /c 12b /n >nul | |
| cls | |
| if !errorlevel! equ 3 goto HOME | |
| if !errorlevel! equ 2 ( | |
| set /p "mcpackPath=Enter extracted MCPACK path (where manifest.json is located): " | |
| echo. | |
| set "mcpackPath=!mcpackPath:"=!" | |
| if not defined mcpackPath ( | |
| echo !ERR![^^!] MCPACK path can't be empty!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| if not exist "!mcpackPath!" ( | |
| echo !ERR![^^!] Invalid path!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| if not exist "!mcpackPath!\manifest.json" ( | |
| echo !ERR![^^!] manifest.json not found in the folder!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| set "isInvalidPack=" | |
| if not exist "!mcpackPath!\lighting\*.json" (set isInvalidPack=1) | |
| if not exist "!mcpackPath!\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if not exist "!mcpackPath!\subpacks\novc\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if not exist "!mcpackPath!\subpacks\vc\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if defined isInvalidPack ( | |
| echo !ERR![^^!] Folder doesn't contain Mirai files!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| set "PACK_ROOT=!mcpackPath!" | |
| goto manifestFound | |
| ) | |
| if !errorlevel! equ 1 ( | |
| set /p "downloadLink=Enter Mirai MCPACK link: " | |
| echo. | |
| "downloadLink=!downloadLink: =!" | |
| if not defined downloadLink ( | |
| echo !ERR![^^!] MCPACK link can't be empty!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| cls | |
| echo !YLW![*] Downloading Mirai...!RST! | |
| if defined DEBUG ( | |
| echo !GRY!curl -L "!downloadLink!" -o "mirai_tmp.zip"!RST! | |
| pause >nul | |
| ) | |
| curl -L "!downloadLink!" -o "mirai_tmp.zip" | |
| if !errorlevel! equ 0 (echo !YLW![*] Download complete, extracting now...!RST!) | |
| echo. | |
| if defined DEBUG ( | |
| echo !GRY!mkdir "!PACK_ROOT!" | |
| echo powershell -Command "Expand-Archive -Path mirai_tmp.zip -DestinationPath '!PACK_ROOT!'"!RST! | |
| pause >nul | |
| ) | |
| mkdir "!PACK_ROOT!" | |
| powershell -Command "Expand-Archive -Path mirai_tmp.zip -DestinationPath '!PACK_ROOT!'" | |
| if exist "!PACK_ROOT!\manifest.json" goto manifestFound | |
| for /d %%F in ("!PACK_ROOT!\*") do ( | |
| if exist "%%F\manifest.json" ( | |
| for %%S in ("%%F\*") do ( | |
| if defined DEBUG ( | |
| echo !GRY!move /Y "%%S" "!PACK_ROOT!"!RST! | |
| pause >nul | |
| ) | |
| move /Y "%%S" "!PACK_ROOT!" | |
| ) | |
| for /d %%S in ("%%F\*") do ( | |
| if defined DEBUG ( | |
| echo !GRY!move /Y "%%S" "!PACK_ROOT!"!RST! | |
| pause >nul | |
| ) | |
| move /Y "%%S" "!PACK_ROOT!" | |
| ) | |
| goto manifestFound | |
| ) | |
| ) | |
| set "isInvalidPack=" | |
| if not exist "!PACK_ROOT!\lighting\*.json" (set isInvalidPack=1) | |
| if not exist "!PACK_ROOT!\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if not exist "!PACK_ROOT!\subpacks\novc\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if not exist "!PACK_ROOT!\subpacks\vc\renderer\materials\*.material.bin" (set isInvalidPack=1) | |
| if defined isInvalidPack ( | |
| echo !ERR![^^!] Folder doesn't contain Mirai files!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| ) | |
| ) | |
| echo !ERR![^^!] Can't find manifest.json!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| :manifestFound | |
| cls | |
| echo !YLW![?] Choose a subpack!RST! | |
| echo. | |
| echo !WHT![1] Volumetric Clouds Enabled!RST! | |
| echo !WHT![2] Volumetric Clouds Disabled!RST! | |
| echo !RED![B] Go back!RST! | |
| echo. | |
| echo !YLW!Press corresponding key to confirm your choice...!RST! | |
| choice /c 12b /n >nul | |
| if !errorlevel! equ 3 goto HOME | |
| if !errorlevel! equ 2 set "SUBPACK_NAME=novc" | |
| if !errorlevel! equ 1 set "SUBPACK_NAME=vc" | |
| cls | |
| echo !YLW![*] Copying Mirai files to Minecraft location...!RST! | |
| echo. | |
| for %%F in ("!PACK_ROOT!\renderer\materials\*") do ( | |
| set "fileName=%%~nxF" | |
| if defined DEBUG ( | |
| echo !GRY!rename "!MCLOCATION!\data\renderer\materials\!fileName!" "!fileName!.bak"!RST! | |
| pause >nul | |
| ) | |
| rename "!MCLOCATION!\data\renderer\materials\!fileName!" "!fileName!.bak" | |
| if defined DEBUG ( | |
| echo !GRY!copy /d /b "%%F" "!MCLOCATION!\data\renderer\materials"!RST! | |
| pause >nul | |
| ) | |
| copy /d /b "%%F" "!MCLOCATION!\data\renderer\materials" | |
| ) | |
| echo !YLW![*] Copying subpack files...!RST! | |
| for %%F in ("!PACK_ROOT!\subpacks\!SUBPACK_NAME!\renderer\materials\*") do ( | |
| set "fileName=%%~nxF" | |
| if defined DEBUG ( | |
| echo !GRY!rename "!MCLOCATION!\data\renderer\materials\!fileName!" "!fileName!.bak"!RST! | |
| pause >nul | |
| ) | |
| rename "!MCLOCATION!\data\renderer\materials\!fileName!" "!fileName!.bak" | |
| if defined DEBUG ( | |
| echo !GRY!copy /d /b "%%F" "!MCLOCATION!\data\renderer\materials"!RST! | |
| pause >nul | |
| ) | |
| copy /d /b "%%F" "!MCLOCATION!\data\renderer\materials" | |
| ) | |
| echo !YLW![*] Copying lods files...!RST! | |
| if defined CONSIDER_LODS_FILES ( | |
| for %%F in ("!PACK_ROOT!\renderer\reflection_configs\lods\*") do ( | |
| set "fileName=%%~nxF" | |
| if defined DEBUG ( | |
| echo !GRY!rename "!MCLOCATION!\data\renderer\reflection_configs\lods\!fileName!" "!fileName!.bak"!RST! | |
| pause >nul | |
| ) | |
| rename "!MCLOCATION!\data\renderer\reflection_configs\lods\!fileName!" "!fileName!.bak" | |
| if defined DEBUG ( | |
| echo !GRY!copy /d /b "%%F" "!MCLOCATION!\data\renderer\reflection_configs\lods"!RST! | |
| pause >nul | |
| ) | |
| copy /d /b "%%F" "!MCLOCATION!\data\renderer\reflection_configs\lods" | |
| ) | |
| ) | |
| echo !GRN![*] Install is complete^^!!RST! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| :: Uninstall | |
| :option-2 | |
| cls | |
| echo !YLW![*] Removing Mirai files from Minecraft location...!RST! | |
| echo. | |
| for %%F in ("!MCLOCATION!\data\renderer\materials\*.bak") do ( | |
| set "fileNameWithoutExtension=%%~nF" | |
| if defined DEBUG ( | |
| echo !GRY!del /q "!MCLOCATION!\data\renderer\materials\!fileNameWithoutExtension!"!RST! | |
| pause >nul | |
| ) | |
| del /q "!MCLOCATION!\data\renderer\materials\!fileNameWithoutExtension!" | |
| if defined DEBUG ( | |
| echo !GRY!rename "%%F" "!fileNameWithoutExtension!"!RST! | |
| pause >nul | |
| ) | |
| rename "%%F" "!fileNameWithoutExtension!" | |
| ) | |
| if defined CONSIDER_LODS_FILES ( | |
| for %%F in ("!MCLOCATION!\data\renderer\reflection_configs\lods\*.bak") do ( | |
| set "fileNameWithoutExtension=%%~nF" | |
| if defined DEBUG ( | |
| echo !GRY!del /q "!MCLOCATION!\data\renderer\reflection_configs\lods\!fileNameWithoutExtension!"!RST! | |
| pause >nul | |
| ) | |
| del /q "!MCLOCATION!\data\renderer\reflection_configs\lods\!fileNameWithoutExtension!" | |
| if defined DEBUG ( | |
| echo !GRY!rename "%%F" "!fileNameWithoutExtension!"!RST! | |
| pause >nul | |
| ) | |
| rename "%%F" "!fileNameWithoutExtension!" | |
| ) | |
| ) | |
| echo !GRN![*] Uninstall is complete^^! | |
| echo !GRY! Press any key to go back...!RST! | |
| pause >nul | |
| goto HOME | |
| :: Exit | |
| :option-3 | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment