Skip to content

Instantly share code, notes, and snippets.

@faizul726
Last active December 21, 2024 10:37
Show Gist options
  • Save faizul726/8f420d223febfc6f67c9ceb58428f58a to your computer and use it in GitHub Desktop.
Save faizul726/8f420d223febfc6f67c9ceb58428f58a to your computer and use it in GitHub Desktop.
A (fanmade) helper script to build Newb X Legacy shader.
@echo off
setlocal enabledelayedexpansion
pushd "%~dp0"
set "filename=%~n0"
set "GRY="
set "WHT="
set "RED="
set "RST="
set "python311=python"
set adb_push=
:: PACK VERSION
::set "packv=15"
:: USE ANY ONE ADB PUSH COMMAND
::set adb_push=adb push build\android\. /sdcard/Android/data/com.mojang.minecraftpe.patch/files/games/com.mojang/development_resource_packs/<NAME>/renderer/materials
::set adb_push=adb push build\merged\. /sdcard/Android/data/com.mojang.minecraftpe.patch/files/games/com.mojang/development_resource_packs/<NAME>/renderer/materials
if "%filename:~-2,1%" neq "_" set "escape=" & goto :main
set escape=true
if "%filename:~-2,2%" equ "_0" cmd /k
if "%filename:~-2,2%" equ "_1" goto :choice-1
if "%filename:~-2,2%" equ "_2" goto :choice-2
if "%filename:~-2,2%" equ "_3" goto :choice-3
:main
cls
echo !WHT!Newb Builder Tool
echo !GRY!Made by @faizul726 ^| 20241221
echo !RST!
echo [1] mats ^(selective^)
echo [2] mats ^(all^)
echo [3] pack
echo.
echo [4] Set -m value
echo [5] Set -p value
echo [6] Set pack arguments
echo.
echo !GRY!Press corresponding key to confirm your choice...
echo !RST!
choice /c 123456 /n >nul
goto :choice-%errorlevel%
:choice-1
if not exist _matsm.txt cls & echo !RED![^^!] -m value not set.!RST! & echo !GRY!Press any key to exit...!RST! & pause >nul & if defined escape (exit /b 0) else (goto :main)
set /p matsm=<_matsm.txt
if exist _platform.txt (set /p platform=<_platform.txt) else (set "platform=windows")
echo !GRY!Executing: %python311% tool mats -m %matsm% -p %platform%!RST!
%python311% tool mats -m %matsm% -p %platform%
echo.
if defined adb_push %adb_push:rwxrwr-r=placebo%
if defined escape exit /b 0
pause
goto :main
:choice-2
if exist _platform.txt (set /p platform=<_platform.txt) else (set "platform=windows")
echo !GRY!Executing: %python311% tool mats -p %platform%!RST!
%python311% tool mats -p %platform%
echo.
if defined adb_push %adb_push:rwxrwr-r=placebo%
if defined escape exit /b 0
pause
goto :main
:choice-3
if exist _platform.txt (set /p platform=<_platform.txt) else (set "platform=windows")
if exist _packarg.txt (set /p packarg=<_packarg.txt) else (set "packarg=")
echo !GRY!Executing: %python311% tool pack -p %platform% %packarg% %packv%!RST!
%python311% tool pack -p %platform% %packarg% %packv%
echo.
if defined adb_push %adb_push:rwxrwr-r=placebo%
if defined escape exit /b 0
pause
goto :main
:choice-4
cls
echo 1. Actor
echo 2. ActorGlint
echo 3. Clouds
echo 4. EndSky
echo 5. ItemHandColor
echo 6. ItemHandColorGlint
echo 7. ItemHandTextured
echo 8. LegacyCubemap
echo 9. RenderChunk
echo 10. Sky
echo 11. Stars
echo 12. SunMoon
echo 13. Weather
echo.
set /p "matsm=Choice (example: 1 3 5): "
if exist _matsm.txt del /q /s _matsm.txt >nul
set output=
for %%A in (%matsm%) do (
if %%A equ 1 set output=!output!_Actor_
if %%A equ 2 set output=!output!_ActorGlint_
if %%A equ 3 set output=!output!_Clouds_
if %%A equ 4 set output=!output!_EndSky_
if %%A equ 5 set output=!output!_ItemHandColor_
if %%A equ 6 set output=!output!_ItemHandColorGlint_
if %%A equ 7 set output=!output!_ItemHandTextured_
if %%A equ 8 set output=!output!_LegacyCubemap_
if %%A equ 9 set output=!output!_RenderChunk_
if %%A equ 10 set output=!output!_Sky_
if %%A equ 11 set output=!output!_Stars_
if %%A equ 12 set output=!output!_SunMoon_
if %%A equ 13 set output=!output!_Weather_
)
if not defined output goto :main
set output=%output:__= %
set output=%output:_=%
echo %output%>_matsm.txt
goto :main
:choice-5
cls
echo 1. android
echo 2. ios
echo 3. windows
echo 4. merged
echo.
set /p "platform=Choice (example: 1 2 4): "
if exist _platform.txt del /q /s _platform.txt >nul
set output=
for %%A in (%platform%) do (
if %%A equ 1 set output=!output!_android_
if %%A equ 2 set output=!output!_ios_
if %%A equ 3 set output=!output!_windows_
if %%A equ 4 set output=!output!_merged
)
if not defined output goto :main
set output=%output:__=,%
set output=%output:_=%
echo %output%>_platform.txt
goto :main
:choice-6
cls
echo 1. --no-zip
echo 2. --no-label
echo.
set /p "packarg=Choice (example: 1 2): "
if exist _packarg.txt del /q /s _packarg.txt >nul
set output=
for %%A in (%packarg%) do (
if %%A equ 1 set output=!output!_--no-zip_
if %%A equ 2 set output=!output!_--no-label_
)
if not defined output goto :main
set output=%output:__= %
set output=%output:_=%
echo %output%>_packarg.txt
goto :main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment