Advertisement
DePhoegon

V2 - Minecraft Aid Wall jsons

Jul 4th, 2021
2,276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.44 KB | None | 0 0
  1. @echo off
  2. :: Version 2.0
  3. :: Creates json files for 'Walls' of other blocks (pillar blocks, sided blocks, single texture blocks[sand])
  4. :: Does not support slabs/stairs as main block
  5. :: Does not generate the json file for adding block to the list of walls in the minecraft tag file
  6. :: Auto Exits on completion
  7. :: Has escape code that should not be triggered
  8. :: MC 1.16.4 Json files used as structure basis
  9.  
  10. goto Start
  11. :staticvar
  12. set MOD=vanilla_reclaim
  13. set BASEFOLDER=F:\Minecraft-aidfiles\
  14. set BLOCKS=%BASEFOLDER%blockstates\
  15. set BLOCK=%BASEFOLDER%models\block\
  16. set WALL=%BLOCK%wall\
  17. set ITEM=%BASEFOLDER%models\item\
  18. set DROP=%BASEFOLDER%loot_tables\blocks\
  19. set FACE[0]=north
  20. set FACE[1]=east
  21. set FACE[2]=south
  22. set FACE[3]=west
  23. set HEIGHT[0]=low
  24. set HEIGHT[1]=tall
  25. exit /b
  26. :primevar
  27. if NOT EXIST %BLOCKS% ( mkdir %BLOCKS% )
  28. if NOT EXIST %WALL% ( mkdir %WALL% )
  29. if NOT EXIST %ITEM% ( mkdir %ITEM% )
  30. if NOT EXIST %DROP% ( mkdir %DROP% )
  31. set ALLSIDED=""
  32. set NAMES=""
  33. exit /b
  34. :End
  35. exit /b
  36. :Start
  37. call :staticvar
  38. call :primevar
  39. if NOT ["%1"]==[""] (
  40.     set NAMES=%1
  41. ) else (
  42.     set /p NAMES= "Base Block Name: "
  43. )
  44. if NOT ["%2"]==[""] (
  45.     set ALLSIDED=%2
  46.     goto Aurgument
  47. )
  48.  
  49. :Sid
  50. echo Enter ( P ) for Pillars.  Logs & Basalt are pillar blocks
  51. echo Enter ( A ) if block uses the same texture on all sides
  52. echo Enter ( S ) if it uses a Top, side, & bottom texture that are differentecho Enter ( E ) to exit.
  53. echo Provides Basic loot table only. (It breaks, it drops.  nothing more)
  54. set /p ALLSIDED= "Type of block: "
  55.  
  56. :Aurgument
  57. if %ALLSIDED%==A goto Setallsided
  58. if %ALLSIDED%==a goto Setallsided
  59. if %ALLSIDED%==S goto Topped
  60. if %ALLSIDED%==s goto Topped
  61. if %ALLSIDED%==P goto Pillar
  62. if %ALLSIDED%==p goto Pillar
  63. if %ALLSIDED%==E goto End
  64. if %ALLSIDED%==e goto End
  65. echo "Valid Entries are ( A, a, S, s, E, e ), or Exit (E)"
  66. goto Sid
  67.  
  68. :Setallsided
  69. set ALLSIDED=%MOD%:block/wall/
  70. set TEXTURESIDE=%MOD%:block/%NAMES%
  71. goto Blockstate
  72. :Pillar
  73. :Topped
  74. set ALLSIDED=%MOD%:block/wall/
  75. set TEXTURESIDE=%MOD%:block/%NAMES%_side
  76. goto Blockstate
  77.  
  78. :: repeated echos, to a singular file ease of reading in code.
  79. :: thfile = output file for fwrite
  80. :fwrite
  81. echo %~1 >> %tnfile%
  82. exit /b
  83.  
  84. :Blockstate
  85. set /a dirloop=0
  86. set /a heightloop=0
  87. set tname=%NAMES%_wall.json
  88. set tnfile=%BLOCKS%%tname%
  89. set tmodel=%ALLSIDED%%NAMES%_wall_post
  90. echo { > %tnfile%
  91. call :fwrite "  "multipart": ["
  92. call :fwrite "    {"
  93. call :fwrite "     "when": {"
  94. call :fwrite "      "up": "true""
  95. call :fwrite "     },"
  96. call :fwrite "     "apply": {"
  97. call :fwrite "       "model": "%tmodel%""
  98. call :fwrite "     }"
  99. call :fwrite "    },"
  100. :Blockstateloop
  101. if %heightloop% EQU 0 set tmodel=%ALLSIDED%%NAMES%_wall_side
  102. if %heightloop% EQU 1 set tmodel=%ALLSIDED%%NAMES%_wall_side_tall
  103. set /a tyvar=%dirloop%*90
  104. call :fwrite "    {"
  105. call :fwrite "     "when": {"
  106. call :fwrite "       "%%FACE[%dirloop%]%%": "%%HEIGHT[%heightloop%]%%""
  107. call :fwrite "     },"
  108. call :fwrite "     "apply": {"
  109. call :fwrite "      "model": "%tmodel%","
  110. if %tyvar% GTR 0 call :fwrite "      "y": %tyvar%,"
  111. call :fwrite "      "uvlock": true"
  112. call :fwrite "     }"
  113. set /a tnum=%dirloop%+%heightloop%
  114. if %tnum% LSS 4 (
  115.     call :fwrite "    },"
  116.     if %dirloop% EQU 3 (
  117.         set /a dirloop=0
  118.         set /a heightloop=1
  119.     ) else set /a dirloop=%dirloop%+1
  120.     goto Blockstateloop
  121. )
  122. call :fwrite "    }"
  123. call :fwrite "  ]"
  124. call :fwrite }
  125. goto :BlockModels
  126.  
  127. :wallwrite
  128. set tempone=%~1
  129. set temptwo=%~2
  130. set tempthree=%~3
  131. set tparent=bob
  132. if %tempthree%==template set tparent=minecraft:block/template_%temptwo%
  133. if %tempthree%==inventory set tparent=minecraft:block/%temptwo%
  134. if %tparent%==bob exit /b
  135. set tnfile=%WALL%%tempone%_%temptwo%.json
  136. call :fwrite {
  137. call :fwrite "  "parent": "%tparent%","
  138. call :fwrite "  "textures": {"
  139. call :fwrite "    "wall": "%TEXTURESIDE%""
  140. call :fwrite "  }"
  141. call :fwrite }
  142. exit /b
  143.  
  144. :BlockModels
  145. call :wallwrite %NAMES% wall_side template
  146. call :wallwrite %NAMES% wall_post template
  147. call :wallwrite %NAMES% wall_side_tall template
  148. call :wallwrite %NAMES% wall_inventory inventory
  149.  
  150. :: Item for inventory
  151. set tnfile=%ITEM%%NAMES%_wall.json
  152. call :fwrite {
  153. call :fwrite "  "parent": "%ALLSIDED%%NAMES%_wall_inventory""
  154. call :fwrite }
  155.  
  156. :: Blockloot, basic form for walls.
  157. set tnfile=%DROP%%NAMES%_wall.json
  158. call :fwrite {
  159. call :fwrite "  "type": "minecraft:block","
  160. call :fwrite "  "name": "%MOD%:%NAMES%_wall""
  161. call :fwrite }
  162. goto End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement