riking

SOURCE: MC Mod Chooser

Mar 12th, 2011
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Winbatch 12.58 KB | None | 0 0
  1. ::This file will contain the latest version of MC Mod Chooser.
  2. ::http://dl.dropbox.com/u/17987530/mcmodchooser.bat
  3. @echo off
  4. color 0a
  5. SETLOCAL ENABLEEXTENSIONS
  6. if errorlevel 1 echo this shouldnt happen
  7. SETLOCAL ENABLEDELAYEDEXPANSION
  8. if errorlevel 1 echo this shouldnt happen
  9. set execdir=%0
  10. ::you have to change more than the two numbers below to change number of mod slots
  11. set modmin=1
  12. set modmax=9
  13. if exist %1 goto fastmodinstall
  14.     :start
  15. cd "%appdata%\.minecraft"
  16. echo ============Welcome to Minecraft Mod Chooser============
  17. echo.
  18. echo Version 1.4 UNSTABLE
  19. echo build number %random%
  20. echo.
  21. echo.
  22. echo Bug reports go to riking28@gmail.com
  23. echo.
  24. echo.
  25. echo.
  26. echo This program is released under a Creative Commons "CC0" License.
  27. echo.
  28. echo.
  29. pause
  30. if not exist jarmodloader (
  31.     echo.
  32.     echo.
  33.     echo.
  34.     echo It appears this is your first time running the program.
  35.     set section=
  36.     echo Starting Guided Setup.
  37.     goto firstrun
  38. )
  39. cd jarmodloader
  40. if exist setup.lck (
  41.     echo.
  42.     echo.
  43.     echo.
  44.     echo It appears that Guided Setup was cancelled last time you ran it.
  45.     echo MC Mod chooser will now resume Guided Setup.
  46.     for /F "delims=" %%i in (setup.lck) do set section=%%i
  47.     goto firstrun
  48. )  
  49. goto loadsettings
  50.     :firstrun
  51. cd "%execdir%"
  52. pause
  53. call guidedsetup.bat %section%
  54. ::guidedsetup.bat, on a successful run, sets errorlevel to 205.
  55. ::on error 206, you wanted to restart it.
  56. ::on error 200, you have winrar trial. shame.
  57. if %errorlevel% EQU 205 (
  58.     cls
  59.     color 0a
  60.     ::restore color
  61.     echo Success! Guided Setup has executed correctly. You can now use the program.
  62.     cd "%appdata%\.minecraft\jarmodloader"
  63.     goto loadsettings
  64. ) else (
  65.     ::restart
  66.     if %errorlevel% EQU 206 (
  67.         cls
  68.         color 0a
  69.         echo Guided Setup has indicated that it requires a restart.
  70.         set section=start
  71.         goto firstrun
  72.     )
  73.     if %errorlevel% EQU 200 exit /B 200
  74.     ::
  75.     if errorlevel 1 (
  76.         color 0a
  77.         echo.
  78.         echo It appears Guided Setup had an abnormal exit.
  79.         echo Please see above for any details available, and possibly file a bug report.
  80.         echo.
  81.         echo If the problem persists, try deleting the %appdata%\.minecraft\jarmodloader folder and retrying.
  82.         echo.
  83.         set inp=
  84.         set /P inp=An alternative is Manual Setup. To view instructions for this, type 1 and hit enter. If you want to try Guided Setup again, just hit enter.
  85.         if '%inp%'=='1' goto tutorials/c2
  86.         echo.
  87.         echo To rerun Guided Setup, run MCModChooser.bat again.
  88.         echo Thank you for using this program, and we are sorry you are having problems.
  89.         echo.
  90.         echo.
  91.         echo MC Mod Chooser will now terminate.
  92.         echo.
  93.         pause
  94.         exit /B 2
  95. )
  96.     :loadsettings
  97. echo loading settings...
  98. cd "%appdata%\.minecraft\jarmodloader"
  99. set num=0
  100. for /F "eol=# delims=" %%i in (options.txt) do (
  101.     set /A num=!num!+1
  102.     set s!num!=%%i
  103. )
  104. set ej=%s1%
  105. set mcpath=%s2%
  106. set modpath=%s3%
  107. set arcpath=%s4%
  108. set arcname=%s5%
  109. set uspoof=%s6%
  110. if '%arcname%'=='WinRAR' (
  111.     set arcmd=rar
  112. )
  113. if '%arcname%'=='7Zip' (
  114.     set arcmd=7z
  115. )
  116. if '%uspoof%'=='' set uspoof=OFF
  117. echo settings loaded.
  118.     :loadnames
  119. echo loading mods...
  120. ::set Mod#Name=
  121. ::set Mod#Vers=
  122. for /L %%n in (%modmin%,1,%modmax%) do (
  123.     if exist Mod%%n (
  124.         cd Mod%%n
  125.         set switch=y
  126.         for /F "eol=# delims=" %%i in (mod.txt) do (
  127.             if '!switch!'=='y' (
  128.                 set Mod%%nName=%%i
  129.             ) else (
  130.                 set Mod%%nVers=%%i
  131.             )
  132.             set switch=n
  133.         )
  134.         cd ..
  135.         echo Mod%%n loaded.
  136.     ) else (
  137.         echo Mod%%n does not exist.
  138.         set Mod%%nName=NONEXISTENT
  139.         set Mod%%nVers=
  140.     )
  141. )
  142. echo names loaded
  143.     :input
  144. echo.
  145. set return=
  146. ::NAME LENGTH: 22
  147. echo (User spoof is: %uspoof%)
  148. echo  ________________________________
  149. echo [  Select a number %modmin%-%modmax% to load.  ]
  150. echo [1  %Mod1Name%       ] %Mod1Vers%
  151. echo [2  %Mod2Name%       ] %Mod2Vers%
  152. echo [3  %Mod3Name%       ] %Mod3Vers%
  153. echo [4  %Mod4Name%       ] %Mod4Vers%
  154. echo [5  %Mod5Name%       ] %Mod5Vers%
  155. echo [6  %Mod6Name%       ] %Mod6Vers%
  156. echo [7  %Mod7Name%       ] %Mod7Vers%
  157. echo [8  %Mod8Name%       ] %Mod8Vers%
  158. echo [9  %Mod9Name%       ] %Mod9Vers%
  159. echo [                                ]
  160. echo [        Other Tasks             ]
  161. echo [R  Refresh mods                 ]
  162. echo [F  Open Mod folder              ]
  163. echo [C  Change mods; Tutorials       ]
  164. echo [U  Spoof username               ]
  165. echo [E  Exit                         ]
  166. echo [________________________________]
  167. echo.
  168. set minp=
  169. set /P minp=Select one:
  170. if '%minp%'=='R' goto loadsettings
  171. echo %minp%|findstr /r /c:"^[%modmin%-%modmax%,E,C,F,M,U]$" >nul
  172. ::takes input, looks for (start of string) (number) (end of string). if not, causes errorlevel 1.
  173. if errorlevel 1 (
  174.     echo That is an invalid input. (You put '%minp%'^)
  175.     pause
  176.     goto input
  177. )
  178. if '%minp%'=='E' ( exit /B 0 )
  179. if '%minp%'=='C' ( goto input2 )
  180. if '%minp%'=='F' (
  181.     start explorer.exe %appdata%\.minecraft\jarmodloader
  182.     goto input
  183. )
  184. if '%minp%'=='U' (
  185.     goto spoofuser
  186. )
  187. goto loadworld
  188. ::input must be a number 1-9 by now
  189.     :input2
  190. echo.
  191. echo  _________________________________________
  192. echo [          Changing Your Mods             ]
  193. echo [Pick either number OR letter.            ]
  194. echo [                                         ]
  195. echo [1T  Tutorials                            ]
  196. echo [2A  Add new files to an existing mod     ]
  197. echo [3I  Delete the META-INF folder           ]
  198. echo [4R  Rename an existing mod               ]
  199. echo [5M  Move an existing mod to a new slot   ]
  200. echo [     or into/out of storage              ]
  201. echo [6C  Copy an existing mod                 ]
  202. echo [7D  Delete a mod                         ]
  203. echo [8V  View all mods (inc. storage)         ]
  204. echo [9U  Updater Tool                         ]
  205. echo [0E  Return to Main Menu                  ]
  206. echo [_________________________________________]
  207. echo.
  208. set inp=
  209. set /P inp=Select one:
  210. echo %inp%|findstr /r /c:"^[0-9,A,C-E,M,R,T-V,a,c,e,m,r,t,v]$" >nul
  211. if errorlevel 1 (
  212.     echo Invalid input.
  213.     pause
  214.     goto input2
  215. )
  216. echo.
  217. goto input2/%inp%
  218. :input2/0
  219. :input2/E
  220. goto loadsettings
  221. :input2/1
  222. :input2/T
  223. echo This feature is under development.
  224. pause
  225. goto input2
  226. ::goto input3
  227. :input2/2
  228. :input2/A
  229. echo This feature has been disabled due to it not working.
  230. pause
  231. goto input2
  232. ::goto addmods
  233. :input2/3
  234. :input2/I
  235. echo This feature has been disabled due to it not working.
  236. pause
  237. goto input2
  238. ::goto metainf
  239. :input2/4
  240. :input2/R
  241. echo This feature has been disabled due to it not working.
  242. pause
  243. goto input2
  244. ::goto renamer
  245. :input2/5
  246. :input2/M
  247. goto mover
  248. :input2/6
  249. :input2/C
  250. goto copy
  251. :input2/7
  252. :input2/D
  253. goto delete
  254. :input2/8
  255. :input2/V
  256. goto viewer
  257. :input2/9
  258. :input2/U
  259. echo This feature has been disabled due to it not working.
  260. pause
  261. goto input2
  262.  
  263.     :loadworld
  264. echo Loading Mod%minp%...
  265. cd ..
  266. xcopy /y jarmodloader\Mod%minp%\minecraft.jar bin\minecraft.jar
  267. cd jarmodloader
  268. echo Done.
  269. echo.
  270. set return=loadworld/return
  271. goto runMC
  272. :loadworld/return
  273. exit
  274.     :spoofuser
  275. echo Please pick a username to use as the spoof.
  276. set inp=
  277. set /P inp=Username:
  278. if '%inp%'=='' (
  279.     echo Operation cancelled.
  280.     goto input
  281. )
  282. set uspoof=%inp%
  283. goto input
  284.     :copy
  285. echo Please enter the ID of the mod you want to copy from. (Mod# or a storage location)
  286. set from=
  287. set /P from=
  288. echo.
  289. if '%from%'=='' (
  290.     echo Operation cancelled.
  291.     goto input
  292. )
  293. if not exist "%from%" (
  294.     echo That is an invalid entry.
  295.     echo.
  296.     goto copy
  297. )
  298. :copy/inp2
  299. echo Enter the ID of the mod you want to copy to. (Mod# or a storage location)
  300. set dest=
  301. set /P dest=
  302. echo.
  303. if '%dest%'=='' (
  304.     echo Operation cancelled.
  305.     goto input
  306. )
  307. if exist "%dest%" (
  308.     echo That already exists!
  309.     goto copy/inp2
  310. )
  311. xcopy "%from%" "%dest%" /I /Y
  312. cd %modpath%\..\ModArchive
  313. xcopy "%from%" "%dest%" /I /Y
  314.  
  315. cd %appdata%\.minecraft\jarmodloader
  316. echo.
  317. echo Task completed.
  318. echo.
  319. set dest=
  320. set from=
  321. goto input2
  322.     :mover
  323. echo Please enter the ID of the mod you want to move. (Mod# or a storage location)
  324. set from=
  325. set /P from=
  326. echo.
  327. if '%from%'=='' (
  328.     echo Operation cancelled.
  329.     goto input
  330. )
  331. if not exist "%from%" (
  332.     echo That is an invalid entry.
  333.     echo.
  334.     goto mover
  335. )
  336. :mover/inp2
  337. echo Enter the new ID of the mod.
  338. set dest=
  339. set /P dest=
  340. echo.
  341. if '%dest%'=='' (
  342.     echo Operation cancelled.
  343.     goto input
  344. )
  345. if exist "%dest%" (
  346.     echo That already exists!
  347.     goto mover/inp2
  348. )
  349. move "%from%" "%dest%"
  350. cd %modpath%\..\ModArchive
  351. move "%from%" "%dest%">tmp.tmp
  352. erase tmp.tmp
  353. cd %appdata%\.minecraft\jarmodloader
  354. echo.
  355. echo Task completed.
  356. echo.
  357. set dest=
  358. set from=
  359. goto input2
  360.     :delete
  361. echo Please enter the ID of the mod or storage location you would like to delete. You will also get a confirmation prompt.
  362. set inp=
  363. set /P inp=
  364. echo.
  365. if '%inp%'=='' (
  366.     echo Operation cancelled.
  367.     goto input
  368. )
  369. if not exist "%inp%" goto delete
  370. erase /F %inp%
  371. rd %inp%
  372. cd %modpath%\..\ModArchive
  373. erase /F %inp%\*
  374. rd %inp%
  375. cd %appdata%\.minecraft\jarmodloader
  376. echo.
  377. echo Task completed.
  378. echo.
  379. goto input2
  380.     :renamer
  381. echo Enter the ID of the mod you want to rename.
  382. set inp=
  383. set /P inp=
  384. echo.
  385. if '%inp%'=='' (
  386.     echo Operation cancelled.
  387.     goto input
  388. )
  389. if not exist "%inp%" (
  390.     echo That mod does not exist.
  391.     goto renamer
  392. )
  393. cd %inp%
  394. start mod.txt
  395. cd ..
  396. pause
  397. goto input2
  398.     :viewer
  399. dir /A:D /B /O:N /P
  400. pause
  401. echo.
  402. echo Task completed.
  403. echo.
  404. goto input2
  405.     :addmods
  406. set inp=
  407. set /P inp=(Y/N) Are the mod files prepared?
  408. echo.
  409. if '%inp%'=='Y' goto addmods/cont
  410. if '%inp%'=='' (
  411.     echo Operation cancelled.
  412.     goto input
  413. )
  414. echo Press any key when the mod files are prepared in the %modpath% folder.
  415. pause
  416. goto addmods
  417. :addmods/cont
  418. echo.
  419. echo Enter the mod ID of the mod to install to.
  420. set dest=
  421. set /P dest=
  422. echo.
  423. if '%dest%'=='' (
  424.     echo Operation cancelled.
  425.     goto input
  426. )
  427. if not exist "%dest%" (
  428.     echo That mod does not exist!
  429.     goto addmods/cont
  430. )
  431. set return=input2
  432. :addmods/install
  433. cd %arcpath%
  434. start /WAIT %arcmd%.exe a -tzip "%appdata%\jarmodloader\%dest%\minecraft.jar" "%modpath%\*"
  435. if errorlevel 1 (
  436.     echo Errors occurred. Please report this incident.
  437.     pause
  438.     goto input2
  439. )
  440. cd %modpath%
  441. copy * ..\ModArchive\%dest%
  442. echo.
  443. goto input
  444.     :metainf
  445. echo.
  446. echo Enter the mod ID of the mod to delete the META-INF folder of.
  447. set inp=
  448. set /P inp=
  449. echo.
  450. if '%inp%'=='' (
  451.     echo Operation cancelled.
  452.     goto input
  453. )
  454. if not exist "%inp%" (
  455.     echo That mod does not exist!
  456.     goto addmods/cont
  457. )
  458. echo on
  459. start "" /B /D"%arcpath%" /HIGH /WAIT %arcmd% d -tzip "%cd%\%inp%\minecraft.jar" META-INF
  460. echo off
  461. if errorlevel 1 (
  462.     echo Errors occurred. Please report this incident.
  463.     pause
  464. )
  465. goto input2
  466.     :fastmodinstall
  467. echo.
  468. echo.
  469. echo You have reached Fast Mod Install.
  470. echo.
  471. echo If you dragged the archive file onto MC Mod Chooser, it is possible that it will not work.
  472. echo Be prepared to restore from a backup if you are not sure.
  473. echo.
  474. echo TO CONTINUE PRESS ENTER. To run MC Mod Chooser normally, type anything and hit enter.
  475. set inp=
  476. set /P inp=
  477. if '%inp%'=='' goto fastmodinstall/cont1
  478. goto start
  479. :fastmodinstall/cont1
  480. cd %appdata%\.minecraft\jarmodloader
  481. :fastmodinstall/cont
  482. echo.
  483. echo Please enter the ID of the mod in which to install the mod.
  484. set inp=
  485. set /P inp=
  486. echo.
  487. if '%inp%'=='' (
  488.     goto fastmodinstall/cont
  489. )
  490. if not exist %inp% (
  491.     echo That mod does not exist!
  492.     goto fastmodinstall/cont
  493. )
  494. set dest=%inp%
  495. :fastmodinstall/loop
  496. copy %1 %modloc%
  497. echo File %1 processed.
  498. shift
  499. if not defined %1 (
  500.     set return=start
  501.     goto addmods/install
  502. )
  503. goto fastmodinstall/loop
  504.     :runMC
  505. echo Starting Minecraft...
  506. if '%uspoof%'=='OFF' (
  507.     echo.
  508. ) else (
  509.     goto runMC/spoof
  510. )
  511. if %ej% EQU 2 (
  512.     start "" /MAX /D"%mcpath%" Minecraft.exe
  513. ) else (
  514.     cmd /K "start /D:"%mcdir%" C:\WINDOWS\system32\java.exe -Xmx1024M -Xms256M -cp "%mcdir%\Minecraft.jar" net.minecraft.LauncherFrame && pause"
  515. )
  516. exit
  517.     :runMC/spoof
  518. echo.
  519. start "Minecraft SPOOFED USER" /ABOVENORMAL java -Xms512m -Xmx1024m -cp "%APPDATA%\.minecraft\bin\*" -Djava.library.path="%APPDATA%\.minecraft\bin\natives" net.minecraft.client.Minecraft %uspoof% 12345
  520. exit
  521.     :update
  522. echo Please enter the new version number below.
  523. set newvers=
  524. set /P newvers=Minecraft Beta v
  525. set newvers=v%newvers%
  526. echo.
  527. if '%inp%'=='' (
  528.     echo Operation cancelled.
  529.     goto input
  530. )
  531. echo.
  532. :update/inp2
  533. echo Would you like to save the current vanilla as a backup?
  534. echo Enter nothing or a mod ID.
  535. set inp=
  536. echo.
  537. if '%inp%'=='' (
  538.     goto update/copymc
  539. )
  540. move "Mod1" "%inp%"
  541. md Mod1
  542. cd Mod1
  543. echo #Mod name.>mod.txt
  544. echo Vanilla               >>mod.txt
  545. echo #Minecraft version>>mod.txt
  546. echo Beta v%newvers%>>mod.txt
  547. cd ..
  548. :update/copymc
  549. copy /Y ..\bin\minecraft.jar /B Mod1\minecraft.jar /B
  550. echo.
  551. echo MC Mod Chooser is now ready to install mods for Minecraft Beta v%newvers%.
  552. pause
  553. goto input
  554.     :eof
  555. echo Exiting.
  556. pause
Add Comment
Please, Sign In to add comment