DePhoegon icon

V2 - Minecraft Aid Wall jsons

DePhoegon | PRO | 07/04/21 03:26:23 PM UTC | 0 ⭐ | 2659 👁️ | Never ⏰ | []
Batch |

4.44 KB

|

None

|

0 👍

/

0 👎

@echo off
:: Version 2.0
:: Creates json files for 'Walls' of other blocks (pillar blocks, sided blocks, single texture blocks[sand])
:: Does not support slabs/stairs as main block
:: Does not generate the json file for adding block to the list of walls in the minecraft tag file
:: Auto Exits on completion
:: Has escape code that should not be triggered
:: MC 1.16.4 Json files used as structure basis
 
goto Start
:staticvar
set MOD=vanilla_reclaim
set BASEFOLDER=F:\Minecraft-aidfiles\
set BLOCKS=%BASEFOLDER%blockstates\
set BLOCK=%BASEFOLDER%models\block\
set WALL=%BLOCK%wall\
set ITEM=%BASEFOLDER%models\item\
set DROP=%BASEFOLDER%loot_tables\blocks\
set FACE[0]=north
set FACE[1]=east
set FACE[2]=south
set FACE[3]=west
set HEIGHT[0]=low
set HEIGHT[1]=tall
exit /b
:primevar
if NOT EXIST %BLOCKS% ( mkdir %BLOCKS% )
if NOT EXIST %WALL% ( mkdir %WALL% )
if NOT EXIST %ITEM% ( mkdir %ITEM% )
if NOT EXIST %DROP% ( mkdir %DROP% )
set ALLSIDED=""
set NAMES=""
exit /b
:End
exit /b
:Start
call :staticvar
call :primevar
if NOT ["%1"]==[""] (
    set NAMES=%1
) else (
    set /p NAMES= "Base Block Name: "
)
if NOT ["%2"]==[""] (
    set ALLSIDED=%2
    goto Aurgument
)
 
:Sid 
echo Enter ( P ) for Pillars.  Logs & Basalt are pillar blocks
echo Enter ( A ) if block uses the same texture on all sides
echo Enter ( S ) if it uses a Top, side, & bottom texture that are differentecho Enter ( E ) to exit. 
echo Provides Basic loot table only. (It breaks, it drops.  nothing more)
set /p ALLSIDED= "Type of block: "
 
:Aurgument
if %ALLSIDED%==A goto Setallsided
if %ALLSIDED%==a goto Setallsided
if %ALLSIDED%==S goto Topped
if %ALLSIDED%==s goto Topped
if %ALLSIDED%==P goto Pillar
if %ALLSIDED%==p goto Pillar
if %ALLSIDED%==E goto End
if %ALLSIDED%==e goto End
echo "Valid Entries are ( A, a, S, s, E, e ), or Exit (E)"
goto Sid
 
:Setallsided
set ALLSIDED=%MOD%:block/wall/
set TEXTURESIDE=%MOD%:block/%NAMES%
goto Blockstate
:Pillar
:Topped
set ALLSIDED=%MOD%:block/wall/
set TEXTURESIDE=%MOD%:block/%NAMES%_side
goto Blockstate
 
:: repeated echos, to a singular file ease of reading in code.
:: thfile = output file for fwrite
:fwrite
echo %~1 >> %tnfile%
exit /b
 
:Blockstate
set /a dirloop=0
set /a heightloop=0
set tname=%NAMES%_wall.json
set tnfile=%BLOCKS%%tname%
set tmodel=%ALLSIDED%%NAMES%_wall_post
echo { > %tnfile%
call :fwrite "  "multipart": ["
call :fwrite "    {"
call :fwrite "     "when": {"
call :fwrite "      "up": "true""
call :fwrite "     },"
call :fwrite "     "apply": {"
call :fwrite "       "model": "%tmodel%""
call :fwrite "     }"
call :fwrite "    },"
:Blockstateloop
if %heightloop% EQU 0 set tmodel=%ALLSIDED%%NAMES%_wall_side
if %heightloop% EQU 1 set tmodel=%ALLSIDED%%NAMES%_wall_side_tall
set /a tyvar=%dirloop%*90
call :fwrite "    {"
call :fwrite "     "when": {"
call :fwrite "       "%%FACE[%dirloop%]%%": "%%HEIGHT[%heightloop%]%%""
call :fwrite "     },"
call :fwrite "     "apply": {"
call :fwrite "      "model": "%tmodel%","
if %tyvar% GTR 0 call :fwrite "      "y": %tyvar%,"
call :fwrite "      "uvlock": true"
call :fwrite "     }"
set /a tnum=%dirloop%+%heightloop%
if %tnum% LSS 4 (
    call :fwrite "    },"
    if %dirloop% EQU 3 (
        set /a dirloop=0
        set /a heightloop=1
    ) else set /a dirloop=%dirloop%+1
    goto Blockstateloop
)
call :fwrite "    }"
call :fwrite "  ]"
call :fwrite }
goto :BlockModels
 
:wallwrite
set tempone=%~1
set temptwo=%~2
set tempthree=%~3
set tparent=bob
if %tempthree%==template set tparent=minecraft:block/template_%temptwo%
if %tempthree%==inventory set tparent=minecraft:block/%temptwo%
if %tparent%==bob exit /b
set tnfile=%WALL%%tempone%_%temptwo%.json
call :fwrite {
call :fwrite "  "parent": "%tparent%","
call :fwrite "  "textures": {"
call :fwrite "    "wall": "%TEXTURESIDE%""
call :fwrite "  }"
call :fwrite }
exit /b
 
:BlockModels
call :wallwrite %NAMES% wall_side template
call :wallwrite %NAMES% wall_post template
call :wallwrite %NAMES% wall_side_tall template
call :wallwrite %NAMES% wall_inventory inventory
 
:: Item for inventory
set tnfile=%ITEM%%NAMES%_wall.json
call :fwrite {
call :fwrite "  "parent": "%ALLSIDED%%NAMES%_wall_inventory""
call :fwrite }
 
:: Blockloot, basic form for walls.
set tnfile=%DROP%%NAMES%_wall.json
call :fwrite {
call :fwrite "  "type": "minecraft:block","
call :fwrite "  "name": "%MOD%:%NAMES%_wall""
call :fwrite }
goto End

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎